workers-sdk
workers-sdk copied to clipboard
๐ BUG: Support http proxies for `wrangler dev`
What version of Wrangler
are you using?
2.0.22
What operating system are you using?
windows 10
Describe the Bug
wrangler pages publish public --project-name xxxx
X [ERROR] fetch failed
If you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new/choose
Logging in is fine, but when posting a project it fails to capture, setting the http proxy is useless, even though the http proxy allows the browser to open all websites normally
Hi @tianluanchen, could you please clarify what you mean by "setting the http proxy is useless"? Is there an error message?
What steps did you take to setup the http proxy?
I had the same problem. I want to run a worker, but it says fetch failed.
cross-env HTTP_PROXY=http://127.0.0.1:7890 wrangler dev
โ
๏ธ wrangler 2.0.27
--------------------
โฌฃ Listening at http://0.0.0.0:8787
TypeError: fetch failed
at Object.processResponse (C:\Users\Liang\Desktop\้กน็ฎ\็ป็ป\Coding\workers\node_modules\.pnpm\[email protected]\node_modules\wrangler\wrangler-dist\cli.js:70321:27)
at C:\Users\Liang\Desktop\้กน็ฎ\็ป็ป\Coding\workers\node_modules\.pnpm\[email protected]\node_modules\wrangler\wrangler-dist\cli.js:70654:42
at node:internal/process/task_queues:141:7
at AsyncResource.runInAsyncScope (node:async_hooks:202:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:138:8)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
cause: [Error: 23128:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
] {
library: 'SSL routines',
function: 'ssl3_get_record',
reason: 'wrong version number',
code: 'ERR_SSL_WRONG_VERSION_NUMBER'
}
}
Something went wrong:
TypeError: fetch failed
at Object.processResponse (C:\Users\Liang\Desktop\้กน็ฎ\็ป็ป\Coding\workers\node_modules\.pnpm\[email protected].
27\node_modules\wrangler\wrangler-dist\cli.js:70321:27)
at C:\Users\Liang\Desktop\้กน็ฎ\็ป็ป\Coding\workers\node_modules\.pnpm\[email protected]\node_modules\wrangler
\wrangler-dist\cli.js:70654:42
at node:internal/process/task_queues:141:7
at AsyncResource.runInAsyncScope (node:async_hooks:202:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:138:8)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
X [ERROR] fetch failed
If you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new/choose
The OS version is Windows 11 and the wrangler version is 2.0.27.
@Lifeni - do you mind trying something for me?
Does it work if you try run:
cross-env HTTPS_PROXY=http://127.0.0.1:7890 wrangler dev
?
@rozenmd It still doesn't work, the error message is the same as before (ERR_SSL_WRONG_VERSION_NUMBER).
But the error message sometimes becomes Error: read ECONNRESET
or Error: Client network socket disconnected before secure TLS connection was established
. This may be related to my bad network, I will try again after a while.
@Lifeni - so it's a bug, wrangler dev
doesn't handle proxies correctly, wrangler dev --local
should work though
Can you confirm whether other wrangler commands work, like wrangler publish
and wrangler whoami
?
@rozenmd
Two days ago, neither wrangler dev
nor wrangler publish
worked properly, only wrangler dev
would give detailed error messages.
After that, I changed my proxy software. wrangler publish
and wrangler whoami
seem to work fine, but wrangler dev
still doesn't work. Unlike before, it prompts that the upload is complete, but fails to load the page. Below is the new error message.
Run `wrangler dev`
> wrangler dev
โ
๏ธ wrangler 2.0.28
--------------------
Retrieving cached values for userId from ..\..\node_modules\.cache\wrangler
Your worker has access to the following bindings:
- KV Namespaces:
- urls: xxx
โฌฃ Listening at http://0.0.0.0:8787
Total Upload: 15.82 KiB / gzip: 2.88 KiB
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ [b] open a browser, [d] open Devtools, [l] turn on local mode, [c] clear console, [x] to exit โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
C:\Users\Liang\AppData\Roaming\fnm\node-versions\v16.16.0\installation\node_modules\wrangler\wrangler-dist\cli.js:12110
throw ex;
^
Error: connect ETIMEDOUT 199.59.148.9:443
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
Emitted 'error' event on WebSocket3 instance at:
at emitErrorAndClose (C:\Users\Liang\AppData\Roaming\fnm\node-versions\v16.16.0\installation\node_modules\wrangler\wrangler-dist\cli.js:116659:17)
at ClientRequest.<anonymous> (C:\Users\Liang\AppData\Roaming\fnm\node-versions\v16.16.0\installation\node_modules\wrangler\wrangler-dist\cli.js:116565:9)
at ClientRequest.emit (node:events:527:28)
at TLSSocket.socketErrorListener (node:_http_client:454:9)
at TLSSocket.emit (node:events:527:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4039,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '199.59.148.9',
port: 443
}
> curl -I 7653e5587bba444793d44fadfd7d0c7a.lifeni.workers.dev
HTTP/1.1 404 Not Found
Content-Length: 16
Alt-Svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Cf-Ray: 74363a6ddb9f8eff-HKG
Connection: keep-alive
Content-Type: text/plain; charset=UTF-8
Date: Wed, 31 Aug 2022 13:49:13 GMT
Expires: Thu, 01 Jan 1970 00:00:01 GMT
Keep-Alive: timeout=4
Proxy-Connection: keep-alive
Referrer-Policy: same-origin
Server: cloudflare
X-Frame-Options: SAMEORIGIN
I checked the url for the connection timeout and it is this: https://7653e5587bba444793d44fadfd7d0c7a.<name>.workers.dev/
(it changes every time). I can load it in the browser or curl.
So I think the previous problem is more likely a network problem. And there are still some issues with wrangler dev
.
Thanks for that @Lifeni - we have a bug to fix for wrangler dev
to make it support proxies - but does wrangler dev --local
work?
@rozenmd wrangler dev --local
works fine, thank you!