Next.js Static Site Cache Invalidation issue with Cloudflare

We are experiencing an issue where the following happens:

  1. Build and deploy Next.js static site (via next export)
  2. Render build succeeds
  3. Site loads a blank page because the index.html file points to the JS bundles from the prior build (we manually compared the bundle signature from the logs).

Using the “clear build cache and deploy” option works temporarily, but we are seeing this issue intermittently throughout the day. For example, we cleared the cache and deployed at 10pm Wednesday, everything worked great all of Thursday, but then we randomly experienced this issue around 6pm on Thursday.

I suspect this is an issue between Render / Cloudflare and how new builds are cleared from the cache?

Similar issues to this have been raised here and here, but the only solution offered is the “clear build cache and deploy”, which does not fix the problem in our case.

Any help / insights on this appreciated!

1 Like

Hi Zach,

We are currently investigating this issue, you can follow along here for updates. If you are able to provide us with the contents of an index.html that 404s and the output of the network tab from the request showing the asset that is missing that would be very helpful.

1 Like

Hi Zach,

We have mitigated the issue. You shouldn’t see any 404s in the future, and your sites should be serving the latest assets. You do not need to clear the build cache to see the correct behavior.

1 Like

Great, thanks for looking into this!