Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-fetch does not work behind a proxy #1770

Open
deeprobin opened this issue Aug 23, 2023 · 6 comments
Open

node-fetch does not work behind a proxy #1770

deeprobin opened this issue Aug 23, 2023 · 6 comments
Labels

Comments

@deeprobin
Copy link

Reproduction

Steps to reproduce the behavior:

  1. Install some tooling which consumes the fetch api
  2. Go behind some corporate proxy
  3. Try to run

Expected behavior

If not explicitly specified, use of the system proxy.

Under Windows, for example, the proxy settings should be taken into account.
With more priority, the environment variables HTTP_PROXY, HTTPS_PROXY & NO_PROXY should also be taken into account.

Screenshots

image

Your Environment

software version
node-fetch ^3.3.1
node 18.15.0
pnpm 7.30.0
Operating System Microsoft Windows 10 Enterprise Version 22H2 (Build 19045.3208)

Additional context

@deeprobin deeprobin added the bug label Aug 23, 2023
@hinricht
Copy link

Looking forward to a solution, because it completely breaks the usage of many nodeJS apps which use node-fetch behind a proxy.

@hinricht
Copy link

@deeprobin Did you find any workaround for this ?

@deeprobin
Copy link
Author

@deeprobin Did you find any workaround for this ?

@hinricht
Not yet. I have only seen that some tools do the proxy handling themselves and pass it to node-fetch.

In my opinion, this should be part of node-fetch.

@hinricht
Copy link

I just tried https://github.com/rofl0r/proxychains-ng and it solved at least my issue with https://github.com/todogroup/repolinter (which uses node-fetch internally).

@lselden
Copy link

lselden commented Dec 13, 2023

I've been using global-agent with node-fetch for a while now (though on v2.7 and only for node < v18)

import * as globalAgent from 'global-agent';
process.env["GLOBAL_AGENT_HTTP_PROXY"] = process.env.HTTP_PROXY || "http://my.proxy.address:8888";
globalAgent.bootstrap();

@Vringe
Copy link

Vringe commented Mar 18, 2024

Just hit the same problem using live-plugin-manager. I also agree that this should be added to node-fetch instead of every project using node-fetch having to implement their own proxy handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants