workers-sdk
workers-sdk copied to clipboard
๐ BUG: default `0.0.0.0` wrangler dev address not routable in Windows
What version of Wrangler are you using?
2.0.25
What operating system are you using?
Windows 10
Describe the Bug
When using wrangler dev or wrangler pages dev, you'll get output like this:
[pages:inf] Listening on 0.0.0.0:8788
[pages:inf] - http://0.0.0.0:8788
Previously, you could click on this and open up your browser without issue, as well as of course b opens this address too.
Unfortunately, at least within Windows, 0.0.0.0 isn't actually a routable address, and the browser throws a ERR_ADDRESS_INVALID error, and something like this:
It seems like this address may be routable in some OSes, but not Windows. This seems to be due to the changes in #1605
Can confirm it's not routable in Windows, a simple fix could be using Listening on 127.0.0.1:8788 or Listening on localhost:8788 in the advertised URLs in the console. Or just change the default to one of these if it's easier.
Another solution here might be to print all of the available network adapters, like serve does:
โ Serving! โ
โ โ
โ - Local: http://localhost:3000 โ
โ - On Your Network: http://192.168.50.240:3000 |
Or http-server:
npx http-server -a 0.0.0.0
Available on:
http://192.168.50.240:8080
http://127.0.0.1:8080
http://192.168.96.1:8080
http://172.29.160.1:8080
Windows probably isn't the only place that 0.0.0.0 won't be routable. This information could be determined from os.networkInterfaces().
@Skye-31 Since you are picking this up here is a reference to the recent PR that caused this issue in Windows, we need to be able to support the VM/Container environments as well which prefer the 0.0.0.0
reference: https://github.com/cloudflare/wrangler2/pull/1605
Cc: @WalshyDev since you were on that PR too ๐
My plan is to list all available addresses, so this should cover that ๐ Will probably get around to this tomorrow
@JacobMGEvans I filed the original issue you mentioned, and just wanted to give my two cents and to confirm what @Skye-31 said, that keeping the 0.0.0.0 as default while advertising all the available addresses locally in console will suit both local and remote users, including those of us using VMs. ๐
Created 2 PRs. One solves the b button opening 0.0.0.0, in wrangler. The other solves the console log issue. Once those are both merged, will close this
Re-opening this as the issue of what is displayed to the user is only fixed in local mode (i.e. in Miniflare) and not in remote mode (i.e. when using the proxy.ts code).
@petebacondarwin, have also made a PR at #1881 to resolve this ๐