Published files randomly unavailable after deploy

I have a build/main.js which works fine and a build/bundle.js which wrongly redirects to my 404 fallback lambda function.

Both js files are available with netlify dev and if I download the zipped instance from Netlify, they are both there.

Is build/bundle.js a reserved Netlify name or is there a file size limit? (it’s 94kb)


  publish = "../../dist/"
  functions = "functions/"

  # SSR and SPA
  from = "/*"
  to = "/.netlify/functions/get-html"
  status = 404


bundle.js is used by the get-html function. Does that lock it, so it can’t be used from the published folder?

Hi @jakobrosenberg!

I wonder why you set your publish setting like this?
The path is relative to the build directory and there should not be any relevant files upwards of that.
Have you tried just using dist for the publish setting?

1 Like

Hi @marcus

Thank you for the reply.

I’m working on a template which may have multiple deployment options, thus I have <template>/deploy/netlify

I’ll try move the dist folder to netlify/dist.

Another oddity is the redirect. If I disable 404 redirects. All files are there, but if it’s on, half of the files are missing. The dist folder contains prerendered HTMLs and a build folder with ~100 .js files for dynamic import.

EDIT: Moving the files to (’./dist’) did not help. The only thing that seems to solve it, is disabling redirects, but that’s not an option as 404 redirect provides SSR for routes that aren’t prerendered.

EDIT2: I tried running netlify build and then netlify deploy. The new link seems to be working in Chrome and Firefox, except if I visit in incognito mode. Then I get the 404 fallback for most files. You can see the app here: (I’ve shared the link with others who say that CSS doesn’t render, but I’m able to see it as long as I’m not in incognito)

Edit3 Now the CSS and JS files are no longer loading in the last link I sent. It’s as if the published files disappear after a while.

Hi, @jakobrosenberg, all HTTP responses from Netlify contain a special HTTP header which we can use to unambiguously identify the HTTP request/response.

The header I am referring to is the x-nf-request-id header:

Would you please send us that header for an asset which isn’t loading (as even a 404 response will contain this header)?

Hi @luke. Thanks for your interest in this issue.

I just tried the app I linked in my last comment, but all pages were working perfectly fine. Then I tried ~10 rapid navigations to static pages) and then I got the 404 lambda fallback again.

Here’s the requested header:
x-nf-request-id: 821cc0fe-8d07-4822-a9d2-3ee4ba4924c1-5829604

Hey @jakobrosenberg,

thanks for your patience as we investigate this issue. We have been talking about this internally - seems like this might be a bug, but we want to take some additional steps to verify that before we file it and scope work to potentially fix. We might not have the time to get into that until next week.

Thank you for bringing this up to us - we super appreciate it! One of the team will update this thread as soon as we have something to report. :muscle:

Thank you very much, Perry.

Looking forward to hearing from you! :thumbsup:

OK, found what I think is the problem.

You should not use a “404” as a redirect - that is not what it is for. You should “redirect” using 301 or 302 status codes.

If you would like our system to “automatically” return an HTTP 404, you need a STATIC FILE which you name /404.html

In that file, you can do some cute things like a javascript redirect to your function, or instead, you could choose to redirect to your function with a “200” code, which would be a proxy:

/* /.netlify/functions/name 200

…and in that function, you can examine the URL that was redirected and CHOOSE to return a 404 from your function instead (or return 404 unconditionally or whatever)

I understand that it “kinda” works now, but that is the bug - not that it doesn’t work sometimes :slight_smile:

@fool thank you for the follow up.I tried updating my redirect to a 200, but the bug persists. After I click through a few links, I start getting the function again instead of the static files.

  publish = "./public/"
  functions = "api/"

  # SSR and SPA
  from = "/*"
  to = "/.netlify/functions/ssr"
  status = 200

Here’s the x-nf-request-id:

@fool is it possible that this bug is related to the cache of Netlify and would it be possible to disable it?

Heya @jakobrosenberg - sorry to be slow to get back to you!

We have a bug filed on this, but we don’t have any kind of workaround for it right now - nothing we can disable to help fix it :frowning:

Wish I had better news for you today, but I don’t…

As long as it’s filed as a bug, I’m optimistic. If there’s anything I can do to help, let me know. :slight_smile:

1 Like

thank you, @jakobrosenberg. If we have any ideas or updates, we’ll let you know here.