Skip to content

WorkersSubdomain

Source: src/Cloudflare/Workers/Subdomain.ts

The account-wide workers.dev subdomain singleton (/accounts/{account_id}/workers/subdomain). Every Worker with workers.dev enabled is served at https://<script>.<subdomain>.workers.dev.

Each account has at most one subdomain — “creating” this resource claims (or renames to) the requested name. Subdomain names are globally unique across all Cloudflare accounts; claiming a taken name fails with the typed SubdomainAlreadyExists error.

Destroy is capture-and-restore: the subdomain is renamed back to the value it had before Alchemy first managed it. If the account had no subdomain at first touch, destroy removes it entirely.

Warning: renaming or removing the subdomain immediately changes the URL of every deployed Worker on the account that relies on workers.dev. Only manage this resource on accounts where that is acceptable.

const sub = yield* Cloudflare.WorkersSubdomain("Subdomain", {
subdomain: "my-team",
});
// Workers are now served from https://<script>.my-team.workers.dev