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

When navigating to /:Slug unable to get content / [Vue warn]: Unhandled error during execution of setup function / Uncaught (in promise) FetchError: 404 Document not found! #1565

Closed
KhalidT2 opened this issue Sep 28, 2022 · 0 comments · Fixed by #1612

Comments

@KhalidT2
Copy link

KhalidT2 commented Sep 28, 2022

Environment

  • Operating System: Darwin
  • Node Version: v16.17.1
  • Nuxt Version: 3.0.0-rc.8
  • Package Manager: npm@8.15.0
  • Builder: vite
  • User Config: app, typescript, tailwindcss, modules, vite, content, build
  • Runtime Modules: @nuxt/content@2.1.1, @nuxtjs/tailwindcss@5.3.3
  • Build Modules: -

Reproduction

We are unable to provide a repository at the time, but these are the errors we are seeing.

GET http://localhost:3000/api/_content/query?_params={%22where%22:[{%22slug%22:{%22$eq%22:%22company-continues-facility-upgrades%22}},{%22_path%22:%22/corporate-news%22}],%22first%22:true,%22sort%22:[{%22_file%22:1,%22$numeric%22:true}]}&previewToken 404 (Document not found!)

runtime-core.esm-bundler.js:38 [Vue warn]: Unhandled error during execution of setup function
at <[slug] onVnodeUnmounted=fn ref=Ref< Proxy {__v_skip: true} > >
at <Anonymous key="/about/corporate-news/company-continues-facility-upgrades" routeProps= {Component: {…}, route: {…}} pageKey="/about/corporate-news/company-continues-facility-upgrades" >

[slug].vue:25 Uncaught (in promise) FetchError: 404 Document not found! (/api/_content/query?_params={%22where%22:[{%22slug%22:{%22$eq%22:%22company-continues-facility-upgrades%22}},{%22_path%22:%22/corporate-news%22}],%22first%22:true,%22sort%22:[{%22_file%22:1,%22$numeric%22:true}]}&previewToken)
at async setup ([slug].vue:25:1)

Describe the bug

We are running into an issue when querying content by the slug field. In our config the field is represented like the following
- { label: 'Slug', name: 'slug', encoding: 'ascii', required: true, widget: 'string', hint: 'remember-to-use-lowercase-and-dashes' }
and we are querying the CMS in our slug template with

  const post = await queryContent('blog')
  .where({ slug: { $eq: route.params.slug } })
  .findOne()

We are able to see the fields coming in on the frontmatter in our console.logs, but we are receiving the errors above in the Reproduction.

Thanks in advance!

Additional context

No response

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant