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

🐛 BUG: Better error logging in wrangler dev proxy logic

Open JoshFerge opened this issue 2 years ago • 4 comments

What version of Wrangler are you using?

2.4.2

What operating system are you using?

Mac

Describe the Bug

When using wrangler pages dev with the --proxy=PORT option, node, due to the resolution of localhost, will attempt to send this request to the ipv6 loopback address on node17+.

If a developer has their proxy frontend only listening on ipv4, the cloudflare worker will simply print [pages:err] Error: Could not proxy request: TypeError: fetch failed

This just cost me a good 2-3 hours thinking something was wrong with my webpack server. For future developers, a more verbose error message / allow us to specify the host of the proxy would be helpful here: https://github.com/cloudflare/wrangler2/blob/main/packages/wrangler/src/miniflare-cli/assets.ts#L42

JoshFerge avatar Nov 20 '22 23:11 JoshFerge