-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
- P2: nice to haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)feat: errorsRelated to error handling / messages (scope)Related to error handling / messages (scope)
Description
Astro Info
Astro v4.15.4
Node v20.13.0
System macOS (arm64)
Package Manager npm
Output hybrid
Adapter @astrojs/netlify
Integrations @astrojs/tailwind
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Currently if entries of a collection declared in the content/config.ts is missing the required id key, Astro throws the following error:
11:31:29 [ERROR] [types] Required
Stack trace:
at /Users/username/Boulot/tnd/astro-sanity-project-template/node_modules/zod/lib/index.mjs:587:31
[...] See full stack trace in the browser, or rerun with --verbose.
Required
Stack trace:
at get error [as error] (file:///Users/username/Boulot/tnd/astro-sanity-project-template/node_modules/zod/lib/index.mjs:587:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 3)
at async ContentLayer.sync (file:///Users/username/Boulot/tnd/astro-sanity-project-template/node_modules/astro/dist/content/content-layer.js:60:7)
at async AstroBuilder.setup (file:///Users/username/Boulot/tnd/astro-sanity-project-template/node_modules/astro/dist/core/build/index.js:104:5)
As the entries often come from a remote source, TypeScript cannot inform user that the entries are missing the id key. Build error could though.
What's the expected result?
A clear message pointing to the missing key should be provided during the build.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-vostqd-rwqk5v?file=src%2Fcontent%2Fconfig.ts
Participation
- I am willing to submit a pull request for this issue.
Metadata
Metadata
Assignees
Labels
- P2: nice to haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)feat: errorsRelated to error handling / messages (scope)Related to error handling / messages (scope)