cloudflare / workers-sdk

โ›…๏ธ Home to Wrangler, the CLI for Cloudflare Workersยฎ
https://developers.cloudflare.com/workers/
Apache License 2.0
2.74k stars 732 forks source link

๐Ÿ› BUG: #3834

Open yuxiangning opened 1 year ago

yuxiangning commented 1 year ago

Which Cloudflare product(s) does this pertain to?

Wrangler core

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

3.6.0

What version of Node are you using?

v20.5.1

What operating system are you using?

Linux 5.15.90.1-microsoft-standard-WSL2

Describe the Bug

While developing a page project inside nodejs container that has nothing else running, I met the following errors with npm run pages:dev.

Turns out the output of lsof -nPi returns nothing from the container, and it seems the parse logic from https://github.com/cloudflare/workers-sdk/blob/c053403b77fc6e2a4b99a934e8e57bd2593df798/packages/wrangler/src/pages/dev.ts#L697 doesn't quite consider empty result.

I can work around this by running a iperf3 -s to occupy a port such that the lsof error will be gone, but the proxy error is still there, need to dig more into that. Please feel free to correct me though.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

โœ˜ [ERROR] Error scanning for ports of process with PID 84759: Error: Command failed: lsof -nPi

โœ˜ [ERROR] Error scanning for ports of process with PID 84775: Error: Command failed: lsof -nPi

โœ˜ [ERROR] Error scanning for ports of process with PID 84776: Error: Command failed: lsof -nPi

โœ˜ [ERROR] Error scanning for ports of process with PID 84787: Error: Command failed: lsof -nPi

โœ˜ [ERROR] Could not automatically determine proxy port. Please specify the proxy port with --proxy.

mrbbot commented 10 months ago

Hey! ๐Ÿ‘‹ Thanks for reporting this, and apologies for the delayed response. I'd recommend using the --proxy flag if you know what port your server is going to start on (e.g. wrangler pages dev --proxy 5000). It looks like we might need to use an alternative tool though if running inside a Docker container. ๐Ÿ‘