Netlify returns 404 for SSR Nuxt website

Site name: refweek.netlify.app

Hi,

My website is a Nuxt 3 Vue.js app configured with SSR enabled. Here is the full repo : GitHub - polysource-projects/refweek: Simulateur d'emploi du temps de BA1

When I navigate to the Netlify website, it returns a 404 not found error. What can I do to fix it?

Create a _redirects file here: refweek/public at main ¡ epfl-tools/refweek (github.com) with the content:

/* /.netlify/functions/server 200

Thank you for your answer! This doesn’t seem to have worked…

You’re uploading the wrong folder:

Starting to deploy site from '.nuxt/dist'

That’s why I wondered why the redirect is not being generated as Nuxt automatically creates that. The publish folder should probably be dist.

You may remove the _redirects file as that would be automatically created by Nuxt.

2 Likes

I had the same issue! The default netlify picked was ‘.nuxt/dist’ which made sense to me…

Hi! I have the same issue with my Nuxt 3 app : 1. https://master--chipper-speculoos-c8484d.netlify.app/
I’m sorry but I don’t understand what to do to solve this… Can you tell me more please?

Thank you very much :slight_smile:

:wave: @authie.maxime

It appears you were able to get things sorted as I’m not seeing 404s on your site. Let us know if you still need help!

Hi audrey, would you mind explaining what I need to do in my site deploy settings? I am having the same issue

what site is experiencing this?

follow this configuration, for me its worked
Publish directory : dist

thanks for sharing this with the community!

We were a little confused by this answer. Should it be /.nuxt/dist - ? (No).

Just to help clarify (as of this date)

Publish directory: dist

(even that key ^ here is confusing!)

So, just “dist” (and in our case we were using pnpm build

Hey I am having this same issue: depending on how I configure things I either get a 404 or a blank white page, any chance you can check and see if anything stands out to you?
netlify: https://imaginative-snickerdoodle-3b00b0.netlify.app/
github: GitHub - msamricth/newportfolio at nuxtSetup

@emm.talarico Almost any situation where you deploy “the wrong thing” will result in a 404.

If you haven’t already, you should refer to the “Nuxt on Netlify” documentation here:
https://docs.netlify.com/frameworks/nuxt/

As it indicates, the Automatic framework detection should have provided you some suggested configuration.

Since you appear to have ssr enabled in your nuxt.config.ts, you should keep an eye on the Function logs too, just in case there are any errors occuring there.

See:
https://docs.netlify.com/functions/logs/

1 Like

Hey thanks! I had already scrubed Nuxt on Netlify | Netlify Docs and tried various things mentioned there and there isnt anything helpful in my function logs. There was one log in there for server and this is that output:
May 27, 10:38:55 PM: f85aa953 Duration: 624.13 ms Memory Usage: 116 MB
May 27, 10:39:22 PM: 5bca2569 Duration: 216.19 ms Memory Usage: 122 MB
May 27, 10:39:22 PM: 0017adaa Duration: 17.45 ms Memory Usage: 123 MB
May 27, 10:39:48 PM: 4784244d Duration: 41.03 ms Memory Usage: 123 MB
May 27, 10:39:49 PM: 81aaf269 Duration: 8.74 ms Memory Usage: 123 MB

I have tried a whole array of toml and nuxt config set ups and no dice, you can see the various attempts at getting it to work here: Comparing main...nuxtSetup ¡ msamricth/newportfolio ¡ GitHub

I for the time being have a different branch that is working without ssr but am hoping to get ssr to work.

I can add my depoy log too if that would help.

Unfortunately it wouldn’t.
I don’t work for Netlify, don’t use Nuxt, and can’t really help you debug further.

Your build didn’t throw any errors when I ran it locally.
But I also couldn’t confirm that it “works”, since I couldn’t find a way to serve it.

Running npm run preview just resulted in:

image

Yeah preview wouldnt work locally because the nitro preset in the nuxt config is set to netlify instead of node-server. Thanks for the look anyways, I really appreciate it!

@emm.talarico Thanks for the tip, I’ve just changed the nuxt.config.ts to have:

nitro: {
  preset: 'node-server',
},

Then I ran npm run build && npm run preview

The build completes, the preview starts, and I see the same blank page as on Netlify.

Which is why I was trying to preview it locally.
Just to try and identify if the project works when not on Netlify.
You’d know better than I though if what I’ve done is a fair comparison.

I had it working a number of times outside of Netlify in previous iterations. It’s likely not working for you because I nuked the toml file to see if that would help (it didn’t) but that’s the current state of the repo. If you wanted you can try pulling the .toml file out of a previous commit (I linked previously) and try that but without having a Nuxt background idk what would be helpful and thats just going to give you a 404 page on netlify. I had probably tried more than a dozen different configurations.

@emm.talarico While I’m certainly no expert on Nuxt, I don’t see how the netlify.toml has any impact on how it behaves locally, when it doesn’t appear to be running anything that would respect that file (e.g. The Netlify CLI).