cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.57k stars 660 forks source link

🐛 BUG: `wrangler login` only listening `::1` #5937

Open amery opened 3 months ago

amery commented 3 months ago

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

3.57.2

What version of Node are you using?

v20.14.0

What operating system and version are you using?

Ubuntu 22.04.4

Describe the Bug

Observed behavior

when running wrangler login inside a devcontainer wrangler only listens to [::1]:8976 which break vscode's port-forwarding. connections from the host's browser just freeze.

for wrangler dev this can be worked around by adding a rule on wrangler.toml

[dev]
ip = "127.0.0.1"

but there is nothing of the sort for wrangler login, and --ip is not accepted either.

curl -v http://localhost:8976
*   Trying 127.0.0.1:8976...
* connect to 127.0.0.1 port 8976 failed: Connection refused
*   Trying ::1:8976...
* Connected to localhost (::1) port 8976 (#0)
> GET / HTTP/1.1
> Host: localhost:8976
> User-Agent: curl/7.81.0
> Accept: */*

Expected behavior

listen on both stacks, 127.0.0.1 and ::1.

Steps to reproduce

Please provide a link to a minimal reproduction

https://github.com/amery/issue-wrangler-5937

Please provide any relevant error logs

No response

amery commented 3 months ago

https://github.com/amery/issue-wrangler-5937 created, open on vscode and choose "open in container"

r3dpoint commented 1 month ago

+1 needing this fixed so that I can continue to develop inside a devcontainer locally (via VSCode). vite has this via passing --host 0.0.0.0. my fallback is to have to install my toolchain locally so that i can wrangler login.

tobz1000 commented 1 month ago

I'm using this script as a workaround:

#!/bin/bash

echo "Starting localhost->::1 tunnel..."
socat TCP4-LISTEN:8976,fork TCP6:[::1]:8976 &
tunnel_proc=$!

npx wrangler login

kill $tunnel_proc

Requires socat to be installed in the devcontainer.