wrangler published static files is not atomic?
By not atomic, I mean sometimes the index.html has already updated, but the lastest js file that the index.html referenced doesn't.
In this case, cloudflare will fallback to return the index.html even we are requesting a .js file
What worse, cloudflare will cache the fallback wrong content, because the path ends with .js (cacheable).
so customers can't access our site until the cache expires.
some context:
1. I'm using github actions for npm build, then use wranglish publish to upload dist directly to pages
2. That's a SPA web, filename contains hash (eg. /js/app.1a2b3c4d.js)
3. all cache settings default, and Tiered Cache disabled
Some possible workaround:
1. disable cache if Sec-Fetch-Des doesnt match the fallback content-type
2. disable cache for all fallback
3. disable cache for .js fallback (or just dont fallback .js)
7 Replies
Deployments are atomic.
If we reference a new HTML file, the new JS file has to exist
What if I publish multiple versions in a short period of time?
like 3 version in 1 or 2 mins
I'm currently tracking a possible bug related to this though. I'm not sure yet the cause but it seems like a request is going to another metal which doesn't have the update yet. Race condition situation. Hard to debug so taking a while
Doesn't matter the frequency
got fallback html content on js request, so page load failed
by open the js link directly, it actually returns the index.html
and because it returns a html with http 200, but not hard fail like 404, our client side fallback wont kick-in
For request hit different metals, I notice that pages now supports rollback / ab test feature. Maybe we can switch to new version only when all edges (or main upstreams) ready?
We've supported rollback for a long time but that wouldn't help as you'd be changing what version is on the metals
The best I can recommend right now is to open a ticket and I can add it to my investigation
I'd also recommend not caching yourself and let Pages handle it. That way you are impacted only until the metal updates (which is probably a second later) rather than the cache duration.