workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

๐Ÿ› BUG: default `0.0.0.0` wrangler dev address not routable in Windows

Open Cherry opened this issue 3 years ago โ€ข 8 comments

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

Cherry avatar Aug 10 '22 14:08 Cherry

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.

awthwathje avatar Aug 10 '22 19:08 awthwathje

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().

Cherry avatar Aug 10 '22 21:08 Cherry

@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 ๐Ÿ˜„

JacobMGEvans avatar Aug 11 '22 19:08 JacobMGEvans

My plan is to list all available addresses, so this should cover that ๐Ÿ™‚ Will probably get around to this tomorrow

Skye-31 avatar Aug 11 '22 20:08 Skye-31

@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. ๐Ÿ‘

awthwathje avatar Aug 11 '22 21:08 awthwathje

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

Skye-31 avatar Aug 12 '22 18:08 Skye-31

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 avatar Sep 06 '22 11:09 petebacondarwin

@petebacondarwin, have also made a PR at #1881 to resolve this ๐Ÿ™‚

Skye-31 avatar Sep 18 '22 16:09 Skye-31