404 does not load error.vue
I'm using dynamic routes and when trying to access a non-existing page the app throws a 404. This however does not trigger loading
error.vue
placed in the root folder, instead the normal layout is rendered (without content). Am I missing something obvious here? This used to work flawlessly in Nuxt 2 (with error.vue in the template folder) but in Nuxt 3 I cannot find a way to display the error page.8 Replies
Have you used
throw createError({statusCode:404})
?I just tried to trigger a 404 with
throw createError({ statusCode: 404, statusMessage: 'Page Not Found' });
in [...slug].vue
and the error page does not load. This seems to be an issue with Netlify, it's working locally.hmm... In my code it's working.
Have you created the "error.vue" file and tried running Nuxt again?

Is it working in production or locally? For me locally all good but Netlify refuses to load error.vue
Oh, yes is locally.
As you say maybe that error is Netlify error.
createError({statusCode:404, fatal: true})
to be sure to have the redirection
Thank you @xibman that did the trick!
you're welcome !