Unable to purge by URL in worker

I have a worker that periodically updates a JSON resource available via a URL. When the worker updates that resource, it uses the cloudflare API (https://api.cloudflare.com/client/v4/zones/[zone]/purge_cache) to purge it so the updated data is available. However, even though the API response indicates success, it is not actually purged. Using the API to purge the same URL works when done in Postman. What's going on here?
2 Replies
Chaika
Chaika9mo ago
Same Request body works in postman but not via worker? Sounds like maybe some weird encoding thing? Are you just using the default cache instance (caches.default) in workers?
Razzmatazz
RazzmatazzOP9mo ago
I’m not using the workers cache api; I’m using the cloudflare api where the endpoint is the api.cloudflare.com address I send a post request to that endpoint with the same authentication input postman, and the response indicates success (and it actually purges). I send the same request from a worker using fetch, and it doesn’t purge even though the response also indicates success. This seems like a potential bug in the cloudflare API; I'm surprised nobody else has noticed it
Want results from more Discord servers?
Add your server