-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 BUG: wrangler dev
listens only on ipv4 localhost, not ipv6
#3732
Comments
Interesting! Can definitely take a look at this, thanks for the report Kenton 😃 |
Hey! Wanted to add our experience with this: We have a CLI that (among other functionality) simulates our production generated user API by running a few of our workers locally in We normally start a We'd love to be able to listen on both IPv4 and IPv6 to avoid these cases. Thanks! |
This fix for this is in miniflare so I will be transferring the issue there |
I'm encountering this issue running a local pages environment. Related #2244 |
What version of
Wrangler
are you using?2.6.2
What operating system are you using?
Linux
Describe the Bug
wrangler dev
(with--experimental-local
in my case, not sure if that matters) says that it listens onlocalhost:8787
, but when it says this, it is actually listening specifically on127.0.0.1:8787
. On systems that support ipv6, the hostnamelocalhost
resolves to two different addresses,::1
and127.0.0.1
.wrangler dev
does not appear to listen on[::1]:8787
.This is usually not a problem, as "correct" programs (e.g. web browsers,
curl
, orworkerd
) will try all addresses returned by the DNS query until one of them works. However, Node 18'sfetch()
function only attempts the first address, throwing an exception if that fails. The first address is always::1
, thereforefetch("localhost:8787")
always fails in Node.Arguably both Node and Wrangler are buggy here. Node should be trying all matching addresses, but Wrangler should also be binding to all matching addresses. Fixing the bug on either side solves the specific problem.
(In my case, I am developing a SvelteKit app with a separate Workers-based backend. Although the SvelteKit app is intended to run on Workers itself, it's easiest to develop using the SvelteKit development workflow on Vite, which uses Node. I wanted it to talk to my local
wrangler dev
instance and ran into this issue.)The text was updated successfully, but these errors were encountered: