Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3: queryCollectionNavigation fails on server with error 500: Invalid query #3106

Open
itsmnthn opened this issue Feb 7, 2025 · 2 comments
Labels
question Further information is requested v3

Comments

@itsmnthn
Copy link

itsmnthn commented Feb 7, 2025

Environment

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
@itsmnthn itsmnthn changed the title queryCollectionNavigation fails on server with error "Invalid query" v3: queryCollectionNavigation fails on server with error 500: Invalid query Feb 7, 2025
@farnabaz
Copy link
Member

farnabaz commented Feb 7, 2025

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.

@farnabaz farnabaz added question Further information is requested v3 labels Feb 7, 2025
@itsmnthn
Copy link
Author

itsmnthn commented Feb 7, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested v3
Projects
None yet
Development

No branches or pull requests

2 participants