Enable workers.dev route for worker deployed via API

I'm using the API here to deploy a worker via the API: https://developers.cloudflare.com/api/operations/worker-script-upload-worker-module However, after the worker has been deployed, it will not be accesible at its ...workers.dev url. I can enable it in the dash, but I want to enable it also via the API. I can't find the right API call to do this. With a bit of haxxing, googling, and intercepting traffic from the dash, I have come up the following, which actually works, but I can't find any info about it: https://api.cloudflare.com/client/v4/accounts/...account_id.../workers/services/...script_name.../environments/production/subdomain But I can't find any docs about this. Also, there is about a minute delay before the page appears, so I'm thinking this is not how it is supposed to be done. How should it be done?
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
2 Replies
limikael
limikaelOP8mo ago
Aha yeah that would be the ultimate reference resource in this case! Thanks... Didn't have time to test right now because the code takes a bit of reading to understand and I'm in another flow right now.... But will test it later... ah btw... saw that in the wrangler code there is actually a delay for 30 seconds, with a comment "This is to prevent an issue where a negative cache-hit causes the subdomain to be unavailable for 30 seconds. This is a temporary measure until we fix this on the edge." ... so I guess the delay wasn't because I was doing something wrong...
Want results from more Discord servers?
Add your server