Workers Sites delete old files from KV


It seems storage in KV is steadily going up with every publish for Workers Sites.
We did a daily deploy to production in the 10 past days and since that day KV storage has been going up roughly by the same size as the total site objects.

I can’t find anything in documentation on the topic of Workers Sites and Cloudflare automatically deleting stale or old versions of objects in KV.


Make sure you’re using the latest version of Wrangler, it should clear stale files on publish ever so often.

If it doesn’t, you can clear the automatically created KV __STATIC_CONTENT manually and deploy anew directly after. (Will cause a few seconds gap of accessibility to the content)

it should clear stale files on publish ever so often

Is this mentioned/described in docs anywhere?

I’m on wrangler 1.11.0 and the page shows nothing for more recent versions that is relevant to this (as I read it).

Clearing __STATIC_CONTENT namespace right before a deploy is not an options for a production site of a business.

Ok, my bad, it’s not the Workers Sites but our API.

1 Like

It’s not mentioned, but it’s built into Wrangler.

It actually compiles and compares a list of local and online files and deletes/updates each.

Keep in mind, a publish currently always invalidates files for a few seconds causing 404s.

1 Like