diff --git a/alchemy/src/cloudflare/worker.ts b/alchemy/src/cloudflare/worker.ts index 624c303cb..98fe4d242 100644 --- a/alchemy/src/cloudflare/worker.ts +++ b/alchemy/src/cloudflare/worker.ts @@ -851,9 +851,7 @@ const _Worker = Resource( ) { let adopt = props.adopt ?? this.scope.adopt; const workerName = - props.name ?? - this.output?.name ?? - this.scope.createPhysicalName(id).toLowerCase(); + props.name ?? this.output?.name ?? this.scope.createPhysicalName(id); if (this.phase === "create" && !props.adopt) { // it is possible that this worker already exists and was created by the old Website wrapper with a nested scope // we need to detect this and set adopt=true so that the previous version will be adopted seamlessly diff --git a/alchemy/src/scope.ts b/alchemy/src/scope.ts index f3fa02af6..8edfa2d23 100644 --- a/alchemy/src/scope.ts +++ b/alchemy/src/scope.ts @@ -336,7 +336,8 @@ export class Scope { const stage = this.stage; return [app, ...this.chain.slice(2), id, stage] .map((s) => s.replaceAll(/[^a-z0-9_-]/gi, delimiter)) - .join(delimiter); + .join(delimiter) + .toLowerCase(); } public async spawn<