-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
404 Not Found #1798
Comments
I believe this is the same issue I am facing. I wrote a hacky workaround i.e. to have an extra page to load the API nodes by calling queryContent. So when you run generate, Nitro walks through all the /pages in Nuxt, which loads any queryContent inside those pages. That function additionally runs addPrerenderPath function IF it's running inside the generate script so that the generated payload (dist) will contain the queries too. I wish there was better solution, which is why I started that discussion. I would love if I could put these inside prerender hook somehow but unfortunately I couldn't find a solution for this yet. |
Content module does not support SSR false by default because it highly depends on Nuxt pre-renderer to generate static pages. However, there is an experimental flag that you can use to enable client-side querying. export default defineNuxtConfig({
content: {
experimental: {
clientDb: true
}
}
}) Note that this is an experimental feature and may or may not have some minor breaking changes in the future. |
@farnabaz What do you mean |
I'm stupid, sorry guys... |
I cannot thank you enough for this temporarily fix. I already made my whole portfolio but this was the one part that wasn't working. |
@nlxdodge Actually, you don't need to do this at all. I had the same issue. Since your app is pre-rendered, there shouldn't even be any API call. You probably just forgot the wrap your query content in an |
For example I have an <template>
<ContentDoc v-slot="{ doc }">
<Head>
<Title>>{{ doc.title }}</Title>
<Meta name="description" :content="doc.description" />
<Meta name="keywords" :content="doc.keywords" />
</Head>
<ContentRenderer :value="doc" />
</ContentDoc>
</template> Without any Query. Then I would have to manually get the Query content for all pages? |
@nlxdodge You didn't wrap your queryContent in useAsyncData here: https://github.com/nlxdodge/portfolio-nuxt/blob/d50136ff91765e1019cd3de51670a49d0e713156/pages/posts/index.vue#L69 |
@mrleblanc101 I said that? 😳 |
Sorry I tagged the wrong person |
@mrleblanc101 As you can see in the issue, there is If you have an issue which is not the same as this one, feel free to open a new one And as I said Nuxt Content depends on server APIs, disabling SSR will cause losing those APIs and as the result you will not be able to fetch any content |
@farnabaz i thought SSR was always true when using You can have both when using |
Having similar issues using ssg with ssr false (using Netlify for hosting). I tried setting this flag but it looks like the 404 errors keep happening for me when using queryContent. Has something changed with how one configures this clientDb experimental flag? |
If you got a Content not found. with Nuxt Content, try to explicitly add
|
Thank you very much! It worked now! Indeed it needed (Wrote more details in case it helps anyone in the future since it's a combination of solutions mentioned in this issue and hosting configuration with Nuxt 3) |
What should you do if you have multiple route rules?
This doesn't work for me with either yarn build or yarn generate. |
i have same issue.. how to fix? :( |
+1 |
1 similar comment
+1 |
I'm facing this problem despite using
I've printed the results of the Seems to be the ContentRenderer that has an issue It's really a blocker and happens only on the production site, that was statically generated, not in dev EDIT: It turned out, using |
Environment
Reproduction
Describe the bug
2 .Request URL: https://buck-1238374.cos-website.ap-chongqing.myqcloud.com/api/_content/query/u7BbTyuhiE.1672998422551.json?_params={%22sort%22:[{%22_file%22:1,%22$numeric%22:true}]}
Request Method: GET
Status Code: 404 Not Found
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: