avitorio / outstatic

Outstatic - A static CMS for Next.js

Home Page:https://Outstatic.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getDocuments errors with msg.startsWith is not a function when collection doesn't exist

rinheimerle opened this issue · comments

Provide environment information

Environment: locally
NextJS version 13.4.12

What browser are you using? (if relevant)

Firefox 116.02

How are you deploying your application? (if relevant)

Vercel

Describe the Bug

Recently, I used getDocuments following the basic fetching data example.

The function continually errors with msg.startsWith is not a function.

After some debugging, I noticed the collection hadn't been populated yet in my outstatic/content folder.

Expected Behavior

Ideally, outstatic would return a more meaningful error message, perhaps something like "collection doesn't exist".

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/rinduggan/portfolio

To Reproduce

  1. Use the getDocuments function, following the fetching data example.
  2. For the first parameter, pass in a collection name that doesn't exist in the outstatic/content folder.

Hey @rinduggan, it seems this is resolved based on our discord chat. Would it be possible for you to comment a solution? Thanks