tunnel-agent is an HTTP proxy tunneling agent originally extracted from the now-deprecated `mikeal/request` library. Its primary function is to facilitate HTTP and HTTPS requests through a proxy server, enabling applications to bypass network restrictions or access resources securely via a tunnel. The package's latest version, 0.6.0, was published over nine years ago, in March 2017. It is considered unmaintained and effectively abandoned, with no new versions or significant activity in recent years. Developers should exercise extreme caution or avoid using this package due to its unmaintained status and potential security vulnerabilities, especially given the historical context of its origin from a library with known security issues. Modern alternatives offer better security, maintenance, and features for proxy tunneling. There is an active `@postman/tunnel-agent` fork, but it has its own separate security concerns including detected malware in some versions.
npm install tunnel-agentVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to configure and use `tunnel-agent` to make an HTTP request through an HTTP proxy. It uses environment variables for proxy configuration for security.
Migrate to a actively maintained HTTP tunneling library like `proxy-agent`, `@fastify/http-proxy`, or `https-proxy-agent`. Ensure your chosen alternative is regularly updated and has a strong security posture.
Avoid using `tunnel-agent` entirely. If migration is not immediately possible, thoroughly audit any indirect dependencies that might pull in vulnerable older versions. Scan your project with tools like Snyk or npm audit.
Always use `const tunnel = require('tunnel-agent');` when integrating `tunnel-agent` into your Node.js application. If your project is pure ESM, consider rewriting the functionality or finding an ESM-native alternative.For SOCKS proxy support or more robust authentication, you will need to integrate additional specialized proxy agents. For modern and flexible proxying, consider libraries that offer broader protocol and authentication support out-of-the-box.
Ensure your file is a CommonJS module (`.js` without `"type": "module"` in `package.json` or explicitly `.cjs` extension) and use `const tunnel = require('tunnel-agent');`. If your project is ESM-only, a direct `import tunnel from 'tunnel-agent'` might work as Node.js CJS-ESM interop, but it's generally unstable for abandoned packages.Verify that `tunnel-agent` is installed (`npm list tunnel-agent`). Ensure `const tunnel = require('tunnel-agent');` is the first interaction with the module. This error can also happen if attempting to use a default import in ESM where only named exports exist (which is not the case for this CJS module).No dependency data recorded yet.