Skip to content

Type generation is broken in a multi-worker setup with multiple environments #12971

@Zollerboy1

Description

@Zollerboy1

What versions & operating system are you using?

System:
OS: macOS 15.7.4
CPU: (12) arm64 Apple M4 Pro
Memory: 111.30 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 25.8.0 - /opt/homebrew/bin/node
npm: 11.11.0 - /opt/homebrew/bin/npm
pnpm: 10.30.3 - /opt/homebrew/bin/pnpm
bun: 1.3.10 - /opt/homebrew/bin/bun
Deno: 2.7.2 - /opt/homebrew/bin/deno
npmPackages:
wrangler: ^4.75.0 => 4.75.0

Please provide a link to a minimal reproduction

https://github.com/stillwind-ai/multi-worker-env-repro/tree/781c1b88dface94e4011c33f811a0b15cc5ffacc

Describe the Bug

We have a multi-worker setup with multiple environments defined on all of them. This breaks type generation, because wrangler cannot find the types for the services/durable objects referenced using <worker_name>-<environment>. This means that the generated type files now contain ugly unions between untyped services and the correctly typed ones. See the repro repo (especially worker/worker-configuration.d.ts) for an example.

Please provide any relevant error logs

No response

Metadata

Metadata

Labels

typesTypes issues to do with wrangler type generation

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions