Closed tiwence closed 1 month ago
Do you mind creating a simple reproduction? You can use Nuxt Content Starter
Hello @farnabaz, I did it here : https://stackblitz.com/edit/github-jwakn7?file=pages%2Fworks%2Findex.vue
Same result, when I run npm run generate
and then npm run preview
, there are 404 errors not found when you browser to the blogpost page.
For me, it seems fine. I did generate & preview, and I didn't see any 404, does it work fine in stackblitz?
Similar issue here when trying to deploy on Vercel.
Getting similar logs like the OP when choosing image provider vercel
:
Errors prerendering:
[log] [nitro] ├─ /api/_content/query/dSYHoSd4Bb.1708164042895.json (21ms)
│ ├── Error: [404] Document not found!
│ └── Linked from /_vercel/image?url=%2Fhome%2Flogo.jpg&w=1536&q=100
Different issue when using Vercel:
I can open the start page (/) and all internal links work fine. But once I try to reload the current page, I am getting a 404 error.
Also using nuxt/content and nuxt/i18n.
Deployment on Netlify with same settings works fine.
Don't know how to fix it.
When using @nuxt/content
to create an SSG website, I encountered the same problem as well.
I solved the problem using the following method, and I hope it will be helpful to you:
Add the following configuration to your nuxt.config.ts
:
+ nitro: {
+ prerender: {
+ crawlLinks: true,
+ },
+ },
Hello there, I've deployed my Nuts 3 SSG on firebase without any generating issue by updating my npm dependencies over next/content library.
I'm using next/content 2.11.0 and Nuxt 3.9.3 at least.
@loosheng Thank you for the tip. I added it but still the same behavior on Vercel.
@tiwence I am using Nuxt 3.10.1 and nuxt/content 2.12.0
I can open the home page and from there all links work fine:
https://amalytix-nuxt-504odzs38-amalytix.vercel.app/
However when I reload any page I get a 404 error.
Same config works fine on Netlify.
Here is the excerpt of my nuxt.config.ts
file in case anyone has an idea:
export default defineNuxtConfig({
modules: [
'@nuxt/content',
'@nuxt/image',
'nuxt-headlessui',
'@nuxtjs/tailwindcss',
'@nuxtjs/i18n',
'dayjs-nuxt',
'nuxt-icons',
'nuxt-icon',
'@nuxtjs/seo',
'@dargmuesli/nuxt-cookie-control',
'@zadigetvoltaire/nuxt-gtm'
],
image: {
provider: 'ipxStatic',
},
seo: {
automaticDefaults: false
},
site: {
url: 'https://amalytix-nuxt-git-vercel02-amalytix.vercel.app',
name: 'AMALYTIX',
description: 'AMALYTIX helps vendors and sellers to to get a 360 degree view on their business. Test AMALYTIX for 14 days for free!',
trailingSlash: true, // allow for seo purposes
},
content: {
documentDriven: true,
contentHead: false,
highlight: {
theme: {
default: 'github-light',
dark: 'github-dark'
},
preload: [
'bash',
'python',
'json',
'sh'
]
}
},
i18n: {
defaultLocale: 'de',
locales: ['de', 'en']
},
routeRules: {
'/**': { prerender: true }
},
ssr: true,
nitro: {
static: true,
prerender: {
failOnError: false,
crawlLinks: true,
concurrency: 12,
}
},
})
I would love to host it on Vercel as the site seems faster compared to Netlify.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity.
Environment
Reproduction
Hi there,
I encounter an issue during the SSG of my Nuxt 3 application, using nuxt/content, and nuxt/i18n module. I got some localized markdown files (blog post essentially), and everything work perfectly in development mode and in production mode when I use the
nuxt build
command and start a node server to serve the generated files.Nevertheless, when I want to build a full static application, using the
nuxt generate
command, I got 404 not found when browsing to the specific routes which display the localized markdown content.Describe the bug
Here is the console error print I found :
404 Not Found http://localhost:3000/api/_content/query/LxQhTwa6Tk.1705500999587.json?_params=%7B%22first%22:true,%22where%22:%5B%7B%22_path%22:%22/works/en/test-markdown%22%7D,%7B%22_locale%22:%22en%22%7D%5D,%22sort%22:%5B%7B%22_file%22:1,%22$numeric%22:true%7D%5D%7D
Nothing is displayed of course, whether it be using the queryContent API or ContentRenderer component. When serve in local the generated dist folder, the dynamic route are not found as well.
I scroll a lot of bug reports on this github, and I don't find the right solution for this.
Maybe, The SSG is not yet supported by this module ?
Thank's a lot in advance for your help!
Additional context
No response
Logs
No response