v3: `queryCollectionNavigation` fails on server with error `500: Invalid query`
Environment
- Operating System:
Darwin - Node Version:
v23.6.1 - Nuxt Version:
3.15.4 - CLI Version:
3.21.1 - Nitro Version:
2.10.4 - Package Manager:
[email protected] - Builder:
- - User Config:
devServer,compatibilityDate,future,css,routeRules,modules,gtag,site,ogImage,app,eslint,devtools - Runtime Modules:
@nuxt/[email protected],@unocss/[email protected],@nuxt/[email protected],@nuxtjs/[email protected],@nuxt/[email protected],@nuxt/[email protected],[email protected] - Build Modules:
-
Version
v3
Reproduction
https://stackblitz.com/edit/github-jznv3fwr?file=layers%2Fblog%2Fapp%2Fpages%2Fblog%2Findex.vue
Description
Using queryCollectionNavigation to load the list blogs to display on the blogs list page getting 500 Internal Server error with message Invalid query
Navigating to the page via click loads the correct data but if refreshed meaning the page is fetched from server throws this error
nuxt generate command fails with this error
Additional context
No response
Logs
⚙ The module is disabled, skipping setup. @nuxtjs/og-image 12:47:34 PM
WARN [@nuxtjs/mdc] removing unsafe attribute: href="/" 12:47:38 PM
WARN [@nuxtjs/mdc] removing unsafe attribute: href="/about" 12:47:38 PM
✔ Processed 3 collections and 7 files in 345.44ms (0 cached, 7 parsed) @nuxt/content 12:47:38 PM
ℹ Running with compatibility version 4 nuxt 12:47:39 PM
ℹ Compiled plugins.client.mjs in 598.28ms nuxt 12:47:41 PM
ℹ Compiled plugins.server.mjs in 613.81ms nuxt 12:47:41 PM
ℹ Compiled types/plugins.d.ts in 628.41ms nuxt 12:47:41 PM
✔ Vite client built in 3168ms 12:47:48 PM
✔ Vite server built in 1183ms 12:47:49 PM
✔ Nuxt Nitro server built in 3415 ms nitro 12:47:52 PM
ℹ Vite client warmed up in 3ms 12:47:52 PM
ℹ Vite server warmed up in 2265ms 12:47:55 PM
ℹ File blog/my-blog.md changed on content collection @nuxt/content 12:48:14 PM
ℹ File blog/my-second-blog.md changed on content collection @nuxt/content 12:48:19 PM
ℹ File blog/my-second-blog.md changed on content collection @nuxt/content 12:48:21 PM
ℹ File blog/my-second-blog.md changed on content collection @nuxt/content 12:48:24 PM
ℹ ✨ new dependencies optimized: @unhead/schema-org/vue 12:48:38 PM
ℹ ✨ optimized dependencies changed. reloading 12:48:38 PM
ERROR [nuxt] [request error] [unhandled] [500] Invalid query
[12:49:01 PM] ℹ hmr update /@fs/home/projects/github-jznv3fwr/layers/blog/app/pages/blog/index.vue, /@fs/home/projects/github-jznv3fwr/layers/blog/app/pages/blog/index.vue?macro=true, /@id/virtual:nuxt:%2Fhome%2Fprojects%2Fgithub-jznv3fwr%2F.nuxt%2Froutes.mjs
[12:49:03 PM] ℹ hmr update /@fs/home/projects/github-jznv3fwr/layers/blog/app/pages/blog/index.vue, /@fs/home/projects/github-jznv3fwr/layers/blog/app/pages/blog/index.vue?macro=true, /@id/virtual:nuxt:%2Fhome%2Fprojects%2Fgithub-jznv3fwr%2F.nuxt%2Froutes.mjs (x2)
✔ Vite server hmr 11 files in 56.225ms
ERROR [nuxt] [request error] [unhandled] [500] Invalid query
Hello @itsmnthn There is an issue in the latest release that prevents using uppercase letters in schema fields. This is fixed in the latest commits and will be released in the next patch version. meanwhile, you can test with
npm i https://pkg.pr.new/@nuxt/content@25a0cd9
Another workaround is to rename publishedAt field to something likepublished_at
WARN [@nuxtjs/mdc] removing unsafe attribute: href="/"
As I see these warnings, please consider removing the lock file and re-installing it to get the latest version of @nuxtjs/mdc package which caused this warning.
Hey, using all lowercase works thanks.
Smol feedback not related to the issue
@farnabaz stackblitz link on create issue for creating reproduction does not include sqlite3 as dependency by default which is required for content to work in stackblitz hence auto setup fails