Registry / http-networking / node-fetch-with-proxy

node-fetch-with-proxy

JSON →
library0.1.6jsnpmunverified

Thin wrapper around node-fetch that transparently uses HTTP_PROXY/HTTPS_PROXY environment variables for proxy support. Version 0.1.6, stable but low update cadence (last update 2019). Key differentiator: drop-in replacement for node-fetch that requires no code changes — just set proxy env vars. Unlike node-fetch's native proxy options, it uses proxy-agent under the hood for comprehensive protocol support (http, https, socks).

npm install node-fetch-with-proxy
INSTALL
IMPORT
SIG · NODE-FETCH-WITH-PR
N
node-fetch-with-proxy
http-networkingjavascriptv0.1.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fetch
import fetch from 'node-fetch-with-proxy'
const fetch = require('node-fetch-with-proxy')
Default import works in both CJS and ESM; CJS require also works.
default
import fetch from 'node-fetch-with-proxy'
Module exports a single fetch function.
Headers
import { Headers } from 'node-fetch'
import { Headers } from 'node-fetch-with-proxy'
Headers, Request, Response are not re-exported; import from node-fetch directly.

Sets proxy via environment variable and performs a GET request to httpbin.

import fetch from 'node-fetch-with-proxy'; process.env.HTTP_PROXY = process.env.HTTP_PROXY || 'http://proxy.example.com:8080'; async function main() { try { const res = await fetch('http://httpbin.org/get'); const data = await res.json(); console.log(data); } catch (err) { console.error('Fetch failed:', err.message); } } main();
Debug
Known issues
gotchaHTTP_PROXY is used for both http and https requests; use NO_PROXY to bypass proxy for specific hosts.
fix
Set NO_PROXY env var (comma-separated list of hostnames) to exclude from proxy.
affects: >=0.1.0
gotchaEnvironment variables are only read once at import time; changing them later has no effect.
fix
Set env vars before importing the package.
affects: >=0.1.0
breakingnode-fetch v3 is ESM-only; this wrapper may not be compatible with node-fetch v3 due to CJS dependencies.
fix
Use node-fetch v2 or check compatibility; consider using native fetch (Node 18+).
affects: >=0.1.0
deprecatedPackage last updated in 2019; no known issues but may lack modern node-fetch features.
fix
Consider native fetch or alternatives like undici with proxy support.
affects: >=0.1.0
Errors
Common errors & fixes
Error: getaddrinfo ENOTFOUND proxy.example.com
Proxy hostname cannot be resolved.
fix
Verify HTTP_PROXY value is correct and DNS resolves the proxy host.
TypeError: fetch is not a function
Using named import instead of default import.
fix
Use 'import fetch from 'node-fetch-with-proxy'' (no curly braces).
SyntaxError: Cannot use import statement outside a module
Trying to use ESM import in a CommonJS file without type:module.
fix
Add 'type': 'module' in package.json or use require().
Upgrade
Version history
0.1.6latest on npm
Audit
Dependencies
node-fetchrequiredwrapper around node-fetch; fetches HTTP requests
proxy-agentrequiredhandles proxy connections via environment variables
Agent activity
2 hits · last 30 days
node
2
Resources
node-fetch-with-proxy — npm install node-fetch-with-proxy · libregistry