Description
When using the Cloudflare Agents SDK with a routes configuration in wrangler.jsonc, the deployment fails with error 1042. Removing the routes block and configuring custom domains via the CF Dashboard or API works fine.
Steps to Reproduce
- Create a Worker using the Agents SDK with a Durable Object (e.g., extending
AIChatAgent)
- Add a
routes config to wrangler.jsonc:
- Run
wrangler deploy
Expected Behavior
Worker deploys with the configured route.
Actual Behavior
Deployment fails with error 1042.
Workaround
Remove routes from wrangler.jsonc and configure custom domains via the CF Dashboard or API instead. This works, but having to bypass wrangler.jsonc for routing defeats the purpose of declarative config.
Environment
wrangler v4.x
- Agents SDK (latest)
- Durable Objects with SQLite migrations
compatibility_date: 2025-03-04
compatibility_flags: ["nodejs_compat"]
{ "name": "my-agent", "main": "src/index.ts", "routes": [ { "pattern": "app.example.com/*", "zone_name": "example.com" } ], "durable_objects": { "bindings": [ { "name": "MY_AGENT", "class_name": "MyAgent" } ] } }