You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A missing content folder throws an obscure error. It's not an error I'd expect people to frequently encounter, but I this we can add a more useful error, just to cover this case.
11:48:31 [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/utils/routing.ts:
|- TypeError: (intermediate value).map is not a function
at eval (/home/otterlord/Documents/Repos/api/test/node_modules/@astrojs/starlight/utils/routing.ts:10:66)
at async instantiateModule (file:///home/otterlord/Documents/Repos/api/test/node_modules/vite/dist/node/chunks/dep-df561101.js:55974:9)
11:48:31 [vite] Error when evaluating SSR module /home/otterlord/Documents/Repos/api/test/node_modules/@astrojs/starlight/index.astro: failed to import "/node_modules/@astrojs/starlight/utils/routing.ts"
|- TypeError: (intermediate value).map is not a function
at eval (/home/otterlord/Documents/Repos/api/test/node_modules/@astrojs/starlight/utils/routing.ts:10:66)
at async instantiateModule (file:///home/otterlord/Documents/Repos/api/test/node_modules/vite/dist/node/chunks/dep-df561101.js:55974:9)
error (intermediate value).map is not a function
File:
/home/otterlord/Documents/Repos/api/test/node_modules/@astrojs/starlight/utils/routing.ts:38:66
Code:
37 | /** All entries in the docs content collection. */
> 38 | const docs: StarlightDocsEntry[] = (await getCollection('docs')).map(({ slug, ...entry }) => ({
| ^
39 | ...entry,
40 | slug: normalizeIndexSlug(slug),
41 | }));
Stacktrace:
TypeError: (intermediate value).map is not a function
at /home/otterlord/Documents/Repos/api/test/node_modules/@astrojs/starlight/utils/routing.ts:38:66
at async instantiateModule (file:///home/otterlord/Documents/Repos/api/test/node_modules/vite/dist/node/chunks/dep-df561101.js:55974:9)
My proposal would be to check getCollection returns an array, then if not, throw an error about content not being found.
Link to Minimal Reproducible Example
No response
Participation
I am willing to submit a pull request for this issue.
The text was updated successfully, but these errors were encountered:
Adding a note, but not closing yet until I confirm the cause. It looks like this is related to a behaviour change in Astro, post 3.0.6. I need to confirm if this is intentional. Tf it is, I'll continue working on my edge-case fix, if not, I'll close this and follow up with core
Another note. The behaviour introduced in 3.1.2 is not what is expected, so we'll have to wait for a patch release to finalise behaviour before I can fix this.
What version of
starlight
are you using?0.10.1
What version of
astro
are you using?3.1.2
What package manager are you using?
npm
What operating system are you using?
Linux
What browser are you using?
Firefox
Describe the Bug
A missing content folder throws an obscure error. It's not an error I'd expect people to frequently encounter, but I this we can add a more useful error, just to cover this case.
My proposal would be to check
getCollection
returns an array, then if not, throw an error about content not being found.Link to Minimal Reproducible Example
No response
Participation
The text was updated successfully, but these errors were encountered: