cloudflare / cloudflare/workers-sdk
deploy: config-file routes silently ignored for Workers declaring [assets] (no zone-routes API call; --routes CLI flag works)
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 186
Description
## Summary
`wrangler deploy` silently ignores config-file `routes` (no zone-routes API call at all, no warning, no error) for a Worker that declares an `[assets]` directory. The same account/zone attaches routes correctly for a Worker **without** `[assets]`. Passing the identical routes via the `--routes` CLI flag works, which isolates the failure to the config-file path combined with assets.
## Environment
- wrangler: 4.107.0 (also reproduced with the `opennextjs-cloudflare` deploy wrapper on @opennextjs/cloudflare 1.20.1, which delegates to wrangler)
- platform: macOS arm64, Node 22
- Workers config (TOML), abridged:
```toml
name = "example-shop"
main = ".open-next/worker.js"
compatibility_date = "2026-07-12"
compatibility_flags = ["nodejs_compat", "global_fetch_strictly_public"]
workers_dev = true
preview_urls = true
[assets]
directory = ".open-next/assets"
binding = "ASSETS"
routes = [
{ pattern = "example.com/*", zone_name = "example.com" },
{ pattern = "www.example.com/*", zone_name = "example.com" }
]
[[services]]
binding = "WORKER_SELF_REFERENCE"
service = "example-shop"
```
## Actual behavior
```
$ wrangler deploy --config wrangler.example.toml
Uploaded example-shop
Deployed example-shop triggers
https://example-shop..workers.dev
Current Version ID: ...
```
- Only the workers.dev URL is printed; the two custom routes are neither attached nor mentioned.
- `WRANGLER_LOG=debug` shows only `subdomain` API calls — **zero** `/zones/{zone}/workers/routes` requests.
- `wrangler triggers deploy` (also tried `triggers deploy --dry-run`): same, subdomain-only.
- No error, no warning — completely silent.
## Expected behavior
Config-declared `routes` should attach the same way the CLI-flag path attaches them (and the way the same zone succeeds for a no-assets Worker), or the deploy should fail loudly if it cannot.
## Controls that DO work (isolating the bug)
1. Same account, same zone, a second Worker **without** `[assets]` whose config declares `routes = [{ pattern = "api.example.com/*", zone_name = "example.com" }]` → `wrangler deploy` prints and attaches `api.example.com/* (zone name: example.com)` correctly.
2. For the assets Worker, passing the same routes as CLI flags works immediately:
```
$ wrangler deploy --config wrangler.example.toml --routes "example.com/*" --routes "www.example.com/*"
Deployed example-shop triggers
https://example-shop..workers.dev
example.com/*
www.example.com/*
```
Both patterns then appear in the trigger output and the zone routes API reflects them.
The only difference between the working and broken cases is (a) `[assets]` present and/or (b) routes declared in the config file instead of CLI flags.
## Impact
Any OpenNext/`[assets]` Worker migrated to custom domain routes via config silently keeps only workers.dev; we lost time debugging the deploy wrapper before narrowing it to wrangler. Workaround in use: the CLI `--routes` flag path.
Contributor guide
Research direction
Start in Wrangler's deploy and trigger route-handling entry points, using the provided assets-enabled TOML configuration as the reproduction. Compare the config-file route path with the working --routes CLI path and inspect debug output for zone-routes requests. Done means config-declared routes attach like CLI routes, or deployment reports a clear failure instead of silently omitting them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100