404 error in production, working fine in dev (Nuxt 3)
See original GitHub issueFirst let me say that I’ve checked out several other issues already, but none of the following solutions posted over there works. Some of this things I tried / made sure:
@nuxt/sitemapis independencies- Changed
export default defineNuxtConfig( { ... } )tomodule.exports = { ... }innuxt.config.ts
As stated in the title, /sitemap.xml is working perfectly fine in dev mode (npm run dev). However, when building the site (npm run build) and starting it (nuxi preview), the site returns my 404 page. The /sitemap_style.xsl file is available in production mode. It happens both on my local device as well as on my production server (NGINX reverse proxy). My thoughts are that this is a bug with Nuxt 3, but I cannot say this with 100% certainty.
This is my nuxt.config.ts sitemap object:
sitemap: {
xslUrl: '/sitemap_style.xsl',
routes: async () => {
const { data } = await axios.get('https://api.example.com') // this is the actual URL in my code, which is working
let routes = []
data.data.forEach((page) => {
let route = { url: page.slug, lastmod: page.date_updated }
routes.push(route)
})
return routes
}
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:12
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Nuxt-3: 404 Error page does not work in production
I am working on a project, and I add error.vue to the root directory. This will render error page on development mode. But...
Read more >SSR Handling of 404 and 500 Errors
quasar/app-webpack) Managing the common 404 and 500 HTTP errors in a Quasar server-side rendered app.
Read more >Creating Server-side Rendered Vue.js Apps Using Nuxt.js
The solution to this is clever: Have a version of the framework/library on the server that can build a ready-to-display page. Then send...
Read more >Vuejs - Local link works but after deploy link gets error 404
There are two types of environment in a Vue Application (or React or Angular). Development; Production. While you are running a development server...
Read more >Nuxt 3 Crash Course #10 - Error Pages - YouTube
In this lesson you'll learn how to make a custom error page for the application. Watch the whole course now (without ads) on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sitemap integration with Nuxt3/Nitro needs some additional hooks to generate support that is not stable yet until we can move to use nitro pack (https://github.com/nuxt/framework/discussions/1690)
Thanks for your interest @HelloAlexPan @desaintflorent @dargmuesli to maintain repo 💚
I will try to contact the module author (@NicoPennec) to see how we can work together and support Nuxt3.
bump, has there been any updates here? Our company is starting a fresh project on Nuxt 3 and have the capacity to help work on a Nuxt 3 build if there are any tasks that need to be completed