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

Yes, this is just a workaround. I hope Netlify team fix this issue soon!

In my case, the main issue was not that the static files were actually deleted from the server, but that the cache of HTML containing script tags referencing old file names was continuously returned.

For example, when accessing /foo-page and getting a 404 for xxx.js, the problem wasn’t that xxx.js didn’t exist, but rather that despite the new deployment having the script named yyy.js, the response for /foo-page (HTML) was still returning an old cache referencing xxx.js.

When using Next.js, the script file names include hash values, so the file names easily change if the script content changes. (In my case, it was _buildManifest.js, and since this file was located under a directory name dependent on the Next.js BUILD_ID, the path changed with each build.)

1 Like