`wrangler dev` fails when `workers_dev = true` and custom routes are specified
See original GitHub issueReproduce the bug
It’s very simple. I have a rust project, and I have run this with wrangler.toml
.
name = "do-ws"
workers_dev = true
main = "build/worker/shim.mjs"
compatibility_date = "2022-01-20"
routes = [
{ pattern = "u-tygra-dev.api.pajkovsky.io", custom_domain = true, zone_id = "..." }
]
[build]
command = "cargo install -q worker-build --version 0.0.7 && worker-build --release"
[durable_objects]
bindings = [
{ name = "WEBSOCKETS", class_name = "WebSocketStore" }
]
[[migrations]]
tag = "v1"
new_classes = ["WebSocketStore"]
[env.prod]
name = "do-ws-prod"
workers_dev = false
routes = [
{ pattern = "u-tygra.api.pajkovsky.io", custom_domain = true, zone_id = "..." }
]
vars = { ENVIRONMENT = "prod" }
durable_objects.bindings = [
{name = "WEBSOCKETS", class_name = "WebSocketStore", script_name = "do-ws-prod"}
]
And running wrangler dev
fails with error
- http://192.168.1.244:8787
✘ [ERROR] Error while creating remote dev session: TypeError: fetch failed
at Object.processResponse
(/Users/npajkovsky/freelancer/u-tygra/be/node_modules/wrangler/wrangler-dist/cli.js:8846:27)
at /Users/npajkovsky/freelancer/u-tygra/be/node_modules/wrangler/wrangler-dist/cli.js:9178:42
at node:internal/process/task_queues:141:7
at AsyncResource.runInAsyncScope (node:async_hooks:202:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:138:8)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
cause: Error: getaddrinfo ENOTFOUND pajkovsky.io
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'pajkovsky.io'
}
}
Environment and versions
- operating system: Linux/Mac
- output of
wrangler -V
:
⛅️ wrangler 2.1.11
--------------------
- output of
node -v
: v16.16.0
Why am I getting this error?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
wrangler dev in 11.0 is non-functional when there are ... - GitHub
I have a worker deployed with a very broad/non-specific route, *example.com/* . It handles some generic redirect behavior. I have other workers ......
Read more >Environments · Cloudflare Workers docs
Wrangler will fail to deploy when both workers_dev = true and route (or routes ) are defined. If you are trying to deploy...
Read more >Detecting if we are running in dev mode or in production mode ...
I need to know in my worker script if ...
Read more >Preview and Publish Your Cloudflare Workers Project
Using the wrangler dev command we can look at our Workers serverless function and test ... Deploy to a Custom Domain with Cloudflare...
Read more >Build a Link Shortener with Cloudflare Workers: Deployment
<yoursubdomain>.workers.dev , where name is the project name you defined in the wrangler.toml name key, and yoursubdomain is your Workers ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe this is because we make some requests to the route zone (prewarm, I think, and possibly others). A quick win could be to find those requests and make them to the custom route instead. A workaround for now is to make sure that your root zone resolves to something, but this is definitely something we’ll fix.
Same issue.
System: OS: macOS 13.0 Binaries: Node: 18.9.0 - ~/Library/Caches/fnm_multishells/60050_1667356309613/bin/node Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/60050_1667356309613/bin/yarn npm: 8.19.1 - ~/Library/Caches/fnm_multishells/60050_1667356309613/bin/npm Browsers: Chrome: 107.0.5304.87 Edge: Not Found Firefox: Not Found Safari: 16.1