oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.45k stars 2.71k forks source link

[Node.js] - HTTP Request Agent is invalid! - Via `node-fetch` #5686

Open medz opened 1 year ago

medz commented 1 year ago

What version of Bun is running?

1.0.2+37edd5a6e389265738e89265bcbdf2999cb81a49

What platform is your computer?

Darwin 22.6.0 arm64 arm

What steps can reproduce the bug?

  1. Install node-fetch and socks-proxy-agent
  2. Create a using socks agent:
    import { SocksProxyAgent } from 'socks-proxy-agent';
    const agent = new SocksProxyAgent('socks5h://{ip}:{prot}');
  3. Using node-fetch request:
    import fetch from 'node-fetch';
    const response = fetch('{URL}', { agent });

The socks agent can be simply created by yourself. By monitoring the data flow, it is found that the agent is configured but not used!

What is the expected behavior?

The request is sent correctly through the agent

What do you see instead?

The request did not go through the socks agent, but was requested directly through the local network.

Additional information

Use agent:

matannahmani commented 1 year ago

also happens on axios!

faintsmi1e commented 12 months ago

when i trying to use SOCKS5 proxy with native bun fetch, I get this error: The socket connection was closed unexpectedly. For more information, passverbose: truein the second argument to fetch() looks like node-fetch and axios won't be able to help me either...

liho00 commented 5 months ago

any solutions guys?

tripolskypetr commented 4 days ago

This broke Appwrite :-(

https://github.com/oven-sh/bun/issues/3386 https://github.com/oven-sh/bun/issues/12320