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

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.