apify / proxy-chain

Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.
https://www.npmjs.com/package/proxy-chain
Apache License 2.0
851 stars 145 forks source link

ERR_TUNNEL_CONNECTION_FAILED error when executing with Bun #553

Closed cleiltonoliveira closed 2 months ago

cleiltonoliveira commented 2 months ago

I'm having trouble running code with Bun instead of Node.js. All requests result in net::ERR_TUNNEL_CONNECTION_FAILED error when running with Bun, but when using Node everything is fine. Adding some detailed logs I was able to see some difference in the printed logs: Running with Bun: ProxyServer[8000]: 6 | !!! Handling CONNECT api.ipify.org:443 HTTP/1.1 ProxyServer[8000]: 6 | Using upstream proxy http://package-10001-country-br:@rotating.proxyempire.io:5000/ ProxyServer[8000]: 6 | Using forward()

Running with Node: ProxyServer[8000]: 3 | !!! Handling CONNECT api.ipify.org:443 HTTP/1.1 ProxyServer[8000]: 3 | Using upstream proxy http://package-10001-country-br:@rotating.proxyempire.io:5000/ ProxyServer[8000]: 3 | Using chain() => api.ipify.org:443

My question is: why is this occurring? Could there be a problem with Bun? Why does running with Bun result in the forward method? Could anyone help with this?

jancurn commented 2 months ago

Bun is not officially supported yet, but it would be awesome if you helped us support it by sending a pull request :)