Intermittent 404 Errors and Inconsistent Page Loads on Next.js App Hosted on Netlify

Hello Netlify Community,

I recently started experiencing (mid-day GMT 18th July) a critical issue with my Next.js application hosted on Netlify. The application shows intermittent 404 errors, slow page loads, and inconsistent functionality. These problems occur even though no recent changes to the application.

The 404 errors are as follows:

/_next/static/chunks/webpack-9550a8ccb8d52fdd.js:1 Failed to load resource: the server responded with a status of 404 ()
/_next/static/IZRV9RPWo82lSwelJQnuY/_buildManifest.js:1 Failed to load resource: the server responded with a status of 404 ()
/_next/static/chunks/9496-ad402dba953b6ca4.js:1 Failed to load resource: the server responded with a status of 404 ()
/_next/static/IZRV9RPWo82lSwelJQnuY/_ssgManifest.js:1 Failed to load resource: the server responded with a status of 404 ()
/_next/static/chunks/9001-a1f5baa10cb6159f.js:1 Failed to load resource: the server responded with a status of 404 ()

On some refreshes, when the page loads, the main content doesn’t appear and the errors mentioned above are logged in the console. Here is a screenshot:

On other refreshes, the application doesn’t seem to load JavaScript, resulting in enlarged icons and other misbehaviour (I can only include one screenshot so will try post image in the comments).

Weirdly, the page does load some of the time. However, even when the page loads, it’s significantly slower than usual. I also see these errors in my console log:

GET https://<myapp>/_next/static/IZRV9RPWo82lSwelJQnuY/_ssgManifest.js net::ERR_ABORTED 404
worldwide:41     GET https://<myapp>/_next/static/IZRV9RPWo82lSwelJQnuY/_buildManifest.js net::ERR_ABORTED 404

Additionally, I have noticed an apparent caching issue with the Netlify functions. The data returned by these functions varies slightly between requests, suggesting some problem with caching might be occurring.

Interestingly, some users in different parts of the world have reported no issues, making the problem harder to pinpoint and debug.

I’d greatly appreciate any assistance in diagnosing and resolving this issue, as it’s causing a significant disruption to my application’s operation…

Here is what the page looks like on refreshes where the javascript doesn’t load:

We are running into the same issues as described here, also since yesterday. Whenever a build update in Next.js causes a new js or css file hash, the old files are still requested once deployed and causing 404s with the site ending up in an unusable state. Running with cache cleared did not solve the issue.

Site: https://ghost-explore.netlify.app/

File names according to build output:
CleanShot 2023-07-19 at 14.47.49
File names requested:

1 Like

After diving into the issue further, here are other things I noticed:

  • Similar to Aileen, the files our app is looking for do not match the names of the files built during deployment. If I download the deploy code and open the static/ directory, I see many files that do not match the names of the files my app is trying to look for.
  • There seems to be a caching issue on Netlify functions. I get different results each time I call my function (some results seem like stale values). The mind-boggling part is that the values change whenever I switch my VPN to a different location.
  • There is a delay/caching issue with cookies in Next.js’s server-side rendering code, a.k.a. getServerSideProps. I can see that a cookie is set in my web client, and then once I route to another page that expects that cookie, it is missing in getServerSideProps. Until yesterday, cookies always appeared immediately. The same happens when I remove a cookie. When I remove a cookie in the client and then route to a page that expects the cookie not to be there in getServerSideProps, the ghost cookie appears even though it no longer exists in the browser.
1 Like

When these issues started, I noticed that the Netlify build version changed from @netlify/build 29.16.0 to @netlify/build 29.16.3. That could potentially be the culprit; looking into it further!

Just started running into these issues with a Nextjs app on the 18th as well.

@vjohnston and @AileenCGN, we’re discussing this with both of you in your individual tickets. At least in case of @vjohnston this was a case of manually overriding cache control headers, and I’ve asked @AileenCGN, if they’ve done the same.

@adamqq, if you’re having issues, please share a site to check.

I am getting similar errors

/_next/static/uV-7FC_fMQgYD02_ud2wW/_buildManifest.js net::ERR_ABORTED 404
/_next/static/uV-7FC_fMQgYD02_ud2wW/_ssgManifest.js net::ERR_ABORTED 404

@chiaberry, this hardly seems related. Please open a new thread with some useful details.

Well, this issue still exists. I’m encountering the same issue with NextJS runtime v5. I wish I could reproduce this consistently, but I’m unable to unfortunately. As mentioned earlier in this thread by @AileenCGN, it seems like it old hashed files are still requested instead of new files.

Following screenshot shows the errors:

For example, it’s asking for the file “next/static/chunks/pages/pricing=8c22b4639336f46f.js”
But in the build the the file is called “pricing-e6a3b65eac570727.js”, notice the different hash suffix.

Similarly, it’s asking for buildManifest.js and ssgManifest.js which are in the wrong hashed folder. After spending several hours troubleshooting, I’ve concluded that the issue likely stems from Netlify not caching files from the new build.

I have another website that uses export option in NextJs to generate static html files at build time, and that one is working fine with no issues. It looks like this issue arises when the export option is not used in NextJs.
May be exporting the NextJs app allows for better cache handling in Netlify since it is generating static HTML files during the build time? Not entirely sure.

@ashgrover could you specify the name of the site where you’re seeing this behavior?

I’ve escalated this issue to our developers to take a look at, please refer to this thread for updates moving forward: JavaScript Bundle Issues - Netlify Build Breaking Several Hours after Deployment completes - #15 by kaw

1 Like

@sid.m Thanks for the prompt response.

The issue occurred at https://brisqi.com. I’ve since switched to exporting Next.js builds to generate pages at build time, which has resolved the error on the new deployment.

However, the older version of the site is still running at https://66a828c242d72d0008678f82--brisqi.netlify.app/. I cannot reproduce the issue at the moment, as it only happens intermittently.

1 Like

I am having same issue.


The site works fine in my local environment, but this morning I deployed it after making a small update to my next.js project.

Afterwards I am experiencing Intermittent 404 Errors and Inconsistent Page Loads

site: https://ualgo.trade/

Duplicate: JavaScript Bundle Issues - Netlify Build Breaking Several Hours after Deployment completes