workers-sdk: ๐ BUG: Using both `--route` and `--remote` causes WebSocket error
Which Cloudflare product(s) does this pertain to?
Wrangler core
What version(s) of the tool(s) are you using?
3.5.0
What version of Node are you using?
20.5.1
What operating system are you using?
macOS Ventura 13.5
Describe the Bug
- Create
index.jsfile:
export default {
fetch(req) {
const url = new URL(req.url);
return new Response(`Your hostname is: ${url.hostname}`);
}
}
- Run Wrangler Dev with both
--remoteand--routeflags(with a zone you have access to):
$ wrangler dev index.js --route "goalastair.com/*" --remote
โ
๏ธ wrangler 3.5.0
------------------
โฌฃ Listening at http://0.0.0.0:8787
- http://127.0.0.1:8787
- http://192.168.32.2:8787
Total Upload: 5.96 KiB / gzip: 1.84 KiB
โฒ [WARNING] worker failed to prewarm: Bad Gateway
Waiting for connection...
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ [b] open a browser, [d] open Devtools, [l] turn on local mode, [c] clear console, [x] to exit โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:30632
throw a;
^
Error: WebSocket was closed before the connection was established
at WebSocket2.close (/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:108521:11)
at close (/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:127122:14)
at /Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:127230:7
at jh (/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:29688:15)
at exports2.unstable_runWithPriority (/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:25660:16)
at Pc (/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:26308:16)
at Qg (/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:29651:18)
at /Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:29640:13
at V (/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:25585:22)
at Timeout.w [as _onTimeout] (/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:25420:13)
Emitted 'error' event on WebSocket instance at:
at emitErrorAndClose (/Project/Directory/node_modules/.pnpm/registry.npmjs.org+wrangler@3.5.0/node_modules/wrangler/wrangler-dist/cli.js:108968:17)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v20.5.1
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 20 (9 by maintainers)
Thanks @helloimalastair โin that case Iโll close this issue. The hotkey bug is captured in https://github.com/cloudflare/workers-sdk/issues/3907, I think
Been waiting on this issue for some months now as well. My workaround was to comment out
[route]definition fromwrangler.tomleach time I was running my projects locally, but also needed to remember to un-comment before any commits/deploysโฆJust discovered today that you can pass
--routes=[]on your command viapackage.jsonscripts and it will overwrite the definition fromwrangler.toml.So, the config may look like this:
wrangler.toml:package.json:Hopefully we can get come kind fix, or at least, a flag to bypass
routeswhen using--remote.