Giter Site home page Giter Site logo

node-proxy-agent's Introduction

node-proxy-agent's People

Contributors

adrukh avatar davidpatrick0 avatar dzcpy avatar emmanuelgautier avatar ggoodman avatar jackjocross avatar jbarrus avatar jonapgar avatar matthewmueller avatar nhooyr avatar nulltoken avatar skyhacks avatar thisislawatts avatar tootallnate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-proxy-agent's Issues

Forever opened connection (easy to reproduce)

There is #14 but I'm not sure if it same or not.
Steps to reproduce:
-Install netcat
-Do nc -l -v -p 8888 -L
-Launch code:

var http = require('http');
var ProxyAgent = require('proxy-agent');

// HTTP, HTTPS, or SOCKS proxy to use
var proxyUri = 'http://127.0.0.1:8888';

var opts = {
    method: 'GET',
    host: 'jsonip.org',
    path: '/',
    // this is the important part!
    agent: new ProxyAgent(proxyUri),
    timeout: 10000 // just in case it works
};

// the rest works just like any other normal HTTP request
http.get(opts, onresponse);

function onresponse(res) {
    console.log(res.statusCode, res.headers);
    res.pipe(process.stdout);
}

Result:
Script will connect and send GET http://jsonip.org/ HTTP/1.1 and nothing else will happen. Connection will stay open forever.
I am not good and JS so I can't found place where to fix this problem.
Or how can I manually close connection?

Can't install proxy-agent using NPM

Looks like one of the dependencies set for node-proxy-agent isn't working.

npm ERR! git clone https://github.com/ariya/esprima.git Cloning into bare repository 'c:\Users\markc
u\AppData\Roaming\npm-cache\_git-remotes\https-github-com-ariya-esprima-git-1bd370f9'...
npm ERR! git clone https://github.com/ariya/esprima.git
npm ERR! git clone https://github.com/ariya/esprima.git fatal: unable to access 'https://github.com/
ariya/esprima.git/': Failed connect to github.com:443; No error
npm ERR! Error: Command failed: git clone --mirror https://github.com/ariya/esprima.git c:\Users\mar
kcu\AppData\Roaming\npm-cache\_git-remotes\https-github-com-ariya-esprima-git-1bd370f9
npm ERR! fatal: unable to access 'https://github.com/ariya/esprima.git/': Failed connect to github.c
om:443; No error
npm ERR!
npm ERR!     at ChildProcess.exithandler (child_process.js:703:12)
npm ERR!     at ChildProcess.EventEmitter.emit (events.js:107:17)
npm ERR!     at maybeClose (child_process.js:825:16)
npm ERR!     at Socket.<anonymous> (child_process.js:1042:11)
npm ERR!     at Socket.EventEmitter.emit (events.js:104:17)
npm ERR!     at Pipe.close (net.js:458:12)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm
\\bin\\npm-cli.js" "install"
npm ERR! cwd c:\Users\markcu\Documents\WarningCenter\git\warningcenter\stormtest\adaptor
npm ERR! node -v v0.11.11
npm ERR! npm -v 1.3.25
npm ERR! code 128
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     c:\Users\markcu\Documents\WarningCenter\git\warningcenter\stormtest\adaptor\npm-debug.l
og
npm ERR! not ok code 0

Set the protocol of the Agent

It is possible to set the protocol of the agent manually?
I see that on module agent-base you could set protocol.

Because the agent.protocol, returned from ProxyAgent, is always set to 'http:'

We initialize the proxy agent in this way

if (process.env.HTTPS_PROXY) {
  https.globalAgent = new ProxyAgent(process.env.HTTPS_PROXY);
  console.log(https.globalAgent?.protocol); // always http:
}

thx

using deprecated socks library

Hello

Please upgrade socks-proxy-agent to avoid using a deprecated socks library:

npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm notice created a lockfile as package-lock.json. You should commit this file.

socks-proxy-agent 4.0.1 has socks upgraded to 2.2.0.

Thanks

Honouring no proxy

Hey Nate - could you take a look at this and let me know if this is likely to be merged or not?

#32

regs
Michael

Create new release with socks-proxy updated

Dear @TooTallNate,

According to the last tag of this package(3.0.0 on 65fcf7a), the socks-proxy-agent is set to 3.0.0 (

"socks-proxy-agent": "^3.0.0"
).

Current master branch is updated (d67cb23), but there's no way to fetch that fix with an exact version of the package.

I kindly ask you to tag a new version in this repo, so that I can send another PR to the people of nightwatch to fix the following vulnerability:


[email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0

Thank you for your time reading this issue

v5.0.0 is not compatable with webpack

i am using angular-devkit/build-angular (which uses webpack) to build nodejs server, After updating to npm package node-proxy-agent v5.0.0 dist file failed to start.

../node_modules/vm2/lib/main.js:723:104-111 - Warning: Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

node ./server/dist-server/main.js


/server/dist-server/main.js:469819
  __webpack_require__(60863),
                      ^^^^^
SyntaxError: Unexpected number
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

i think its because of PR, vm2 has a compatibility issues with webpack patriksimek/vm2#70

is there any work around ?

https-proxy-agent-snyk-fork not found, but is a dependecy of proxy-agent?

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/https-proxy-agent-snyk-fork - Not found
npm ERR! 404 
npm ERR! 404  'https-proxy-agent-snyk-fork@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'proxy-agent'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Uninitialized memory exposure vulnerability

Depends on a 1.X.X version of pac-proxy-agent which has an indirect dependency on the package ip version 1.0.1. That version of ip has the uninitialized mem exposure issue. Can you update to 2.0.0 of pac-proxy-agent to resolve this?

upgrading proxy-agent from 3.1.0 to 4.0.1 shows errors in its own dependency

I upgraded the package to the latest version and start getting the below errors at compile time from its dependency "agent-base"

../../node_modules/proxy-agent/node_modules/agent-base/dist/src/index.d.ts(2,8): error TS1192: Module '"net"' has no default export.
../../node_modules/proxy-agent/node_modules/agent-base/dist/src/index.d.ts(3,8): error TS1192: Module '"http"' has no default export.
../../node_modules/proxy-agent/node_modules/agent-base/dist/src/index.d.ts(4,8): error TS1192: Module '"https"' has no default export.

npm install issues

So, whenever I run npm install proxy-agent I get this error:

Cristians-MacBook-Pro:test cristiandouce$ npm i --production proxy-agent
npm WARN package.json test@ No description
npm WARN package.json test@ No repository field.
npm WARN package.json test@ No README data
npm WARN package.json test@ No license field.
npm ERR! addLocal Could not install /var/folders/tb/90xr04011rj3tb611whxl5w40000gn/T/npm-31105-716351e0/git-cache-6e4850550a40/734ff0028274ab4254d2c06e67efbf2dceaf2b72
npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "i" "--production" "proxy-agent"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code EISDIR
npm ERR! errno -21

npm ERR! EISDIR, read
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/cristiandouce/Work/apps/test/npm-debug.log

I've not been able to install any dependency using proxy-agent (some versions of cogent for instance) because of this issue:

Using:

{ npm: '2.10.1',
  http_parser: '2.3',
  modules: '14',
  node: '0.12.4',
  openssl: '1.0.1m',
  uv: '1.5.0',
  v8: '3.28.71.19',
  zlib: '1.2.8' }

From a Macbook Pro retina 13''

I think there must be some broken dependency. But because of the recursive requires between this module and pac-proxy-agent I've surrender to requesting for help! 👯

defaultPort cannot be read for downstream proxy agents

In the standard library http client, if an agent is defined, it tries to read the defaultPort of the agent in order to figure out whether or not to append the port number in the final request made to the endpoint (via the agent).

It seems that when using https-proxy-agent via proxy-agent, since this property is defined on https-proxy-agent itself but not dealt with in proxy-agent directly, the standard library http client can't read the property and thus treats any port numbers as "non-standard". Thus we end up with :443 appended to all of our HTTPS URLs. Despite being in the spec, this has proven to break many servers that don't expect it.

I'm not 100% sure on this but it has taken us a few days to get to some reproducible test cases and this seems to be what the problem is. Equally uncertain yet of the solution but thought I'd raise it in case you can rule it out as an issue.

opts.protocol is undefined

Hi!

Thank you for the excellent module. I was debugging why my proxy set using env vars (HTTP_PROXY and friends) was not being picked up, and I saw that opts was missing the .protocol option. Tried reading through the net docs but couldn't find a definitive source on what the options actually are supposed to contain. It all fails on the dependency broking out if the protocol is not set: https://github.com/Rob--W/proxy-from-env/blob/e0d07a9350568b3a0c3bb28dafd3766206961a02/index.js#L29

For now I added if (!opts.protocol) opts.protocol = opts.secureEndpoint ? 'https' : 'http' which is feels like a hack.

Any advice? I'm happy to provide a PR but not entirely sure what's right here

Compiling error after upgrading the proxy-agent version

Hi Team, after upgrading:

"proxy-agent": "~3.1.1",

to

"proxy-agent": "~4.0.1",

Getting error:

../common/temp/node_modules/agent-base/dist/src/index.d.ts(2,8): error TS1192: Module '"net"' has no default export.
../common/temp/node_modules/agent-base/dist/src/index.d.ts(3,8): error TS1192: Module '"http"' has no default export.
../common/temp/node_modules/agent-base/dist/src/index.d.ts(4,8): error TS1192: Module '"https"' has no default export.

Is this because those modules are actually missing or because my TS config settings?

# tsconfig.json
{
  "compilerOptions": {
    "target": "es2018",
    "module": "commonjs",
    "outDir": "dist/",
    "lib": [
      "es6",
      "es2018"
    ],
    "strict": true,
    "moduleResolution": "node",
    "esModuleInterop": false,
    "resolveJsonModule": true,
    "forceConsistentCasingInFileNames": true,
    "declaration": true,
    "noImplicitAny": false,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "incremental": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": false,
    "inlineSourceMap": true,
    "inlineSources": true,
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "typeRoots": [
      "./node_modules/@types"
    ],
    "types": ["jest", "node"]
  },
  "exclude": [
    "node_modules",
    "dist",
    "src/ui",
  ]
}

Release 2.3.0 is broken on [email protected]

@TooTallNate this change results in the new socks-proxy-agent@4 being pulled in. The 4.x series of socks-proxy-agent introduces a node>=6 constraint due to its reliance on socks@2 (and probably other things) where newer syntax (function argument defaults) is introduced that is a syntax error on [email protected].

Would you consider releasing this as a new major considering this backwards incompatibility and re-releasing a 2.3.x patch release reverting the socks-proxy-agent bump?

How can I help expedite this?

After npm install @5.0.0- typescript build fails

ode_modules/proxy-agent/node_modules/agent-base/dist/src/index.d.ts:2:8 - error TS1192: Module '"net"' has no default export.

2 import net from 'net';
~~~

node_modules/proxy-agent/node_modules/agent-base/dist/src/index.d.ts:3:8 - error TS1192: Module '"http"' has no default export.

3 import http from 'http';
~~~~

node_modules/proxy-agent/node_modules/agent-base/dist/src/index.d.ts:4:8 - error TS1192: Module '"https"' has no default export.

4 import https from 'https';
~~~~~

proxy-agent return circular 302 on endpoints of https://api.meetup.com

This is my test code:

var https = require('https');
var ProxyAgent = require('proxy-agent');

var proxyUri = 'http://localhost:3128';

https.get({
    host: 'api.meetup.com',
    path: '/2/cities',
    agent: new ProxyAgent(proxyUri)
}, function (res) {
    console.log(res.statusCode, res.headers);
    res.pipe(process.stdout);
});

The returned res.headers are

{
     date: 'Thu, 21 Jul 2016 22:35:05 GMT',
     'content-type': 'text/html; charset=iso-8859-1',
     'content-length': '325',
     connection: 'close',
     'set-cookie': ['__cfduid=d6e8ffe944c1eac207a133b7a263ee6121469140504; expires=Fri, 21-Jul-17 22:35:04 GMT; path=/; domain=.meetup.com; HttpOnly'],
     location: 'https://api.meetup.com/2/cities/',
     server: 'cloudflare-nginx',
     'cf-ray': '2c621fbaa2861d30-EZE'
 }

If I comment agent: new ProxyAgent(proxyUri) everything works fine. I tested this with 3 differents proxies.

On this ISSUE they suggest me that it's a proxy-agent bug but I can't found nothing wrong on it.

Update pac-proxy-agent to remove the vulnerability introduced by netmask

Subject of the issue

[email protected] requires [email protected], which has a security problem (see: CVE-2021-29418):
[email protected][email protected][email protected][email protected]

I do not know if this vulnerability actually affects proxy-agent, but it will show up in security reports about dependencies. Since a large number of developers still use [email protected].*(610,771 downloads per week), is there any posibility that you could release an update version for 3.1.* (ie 3.1.2) that introduces a patched version(>=2.0.1) of netmask?

In [email protected], maybe you can perform the following update:
pac-proxy-agent ^3.0.1 ➔ ^4.0.0
where [email protected][email protected][email protected], and [email protected] has fixed the vulnerability CVE-2021-29418.

Thank you for your help and welcome to share other ways to resolve the issue.

https request not work

when i make https request with proxy, i got this error self signed certificate in certificate chain, how can i solve this problem?

How can i use ws with HttpsProxyAgent

My project is create a websocket connection between my computer and a internet websocket server.
Now I want to use proxy.
I get some proxy IP from Internet. Such as: 'http://51.38.71.101:8080'.

Here is my code:

var WebSocket = require('ws');
var http = require("http");
var HttpProxyAgent = require('http-proxy-agent');
var HttpsProxyAgent = require('https-proxy-agent');
var urlUtil = require('url');

var reconnectInterval = 30 * 1000;
var reconnectTimeCount = 0;
var reconnectTotalCount = 10000;
var socket;
var proxy = 'http://51.38.71.101:8080';
var options = urlUtil.parse(proxy);
// var agent = new HttpsProxyAgent(options);
var agent = new HttpProxyAgent(options);

var connect = function(){
    try {
        console.log("========000000======");
        var url = 'ws://115.231.140.70';
        // socket = new WebSocket(url, { agent: agent });
        socket = new WebSocket(url);
        console.log("========1111======");
        socket.on('open', function() {
            console.log("=====connect====success====");
        });
        socket.on('message', function (data, flags) {
            console.log("=====received msg====");
        });
        socket.on('error', function(err) {
            console.log("************" + 'socket error'+ require('util').inspect(err));
        });
        socket.on('close', function() {
            console.log('socket close' + "===============reconnectTimeCount="+reconnectTimeCount);
            if (reconnectTimeCount <= reconnectTotalCount) {
                setTimeout(connect, reconnectInterval);
                reconnectTimeCount ++;
            }
        });
        console.log("========222222======");
    } catch (e) {
        console.log("========333333======");
    }   
    
};

connect();

When I use socket = new WebSocket(url);, my console log is:

SyterLius-MacBook-Air:app Syter$ node test.js 
========000000======
========1111======
========222222======
=====connect====success====

But when I use socket = new WebSocket(url, { agent: agent });, my console log is:

SyterLius-MacBook-Air:app Syter$ node test.js 
========000000======
========1111======
========222222======
************socket errorError: Unexpected server response: 101
    at ClientRequest.req.on (/Users/Syter/Documents/workcode/moshan/hyserver/node_modules/ws/lib/websocket.js:579:7)
    at ClientRequest.emit (events.js:188:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:562:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:113:17)
    at Socket.socketOnData (_http_client.js:449:20)
    at Socket.emit (events.js:188:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:145:17)
socket close===============reconnectTimeCount=0

I have test proxy IP in http.get way like documents said, it's no problem
So how can I do for it??

And my node version is v11.7.0
ws version is 7.0.1
https-proxy-agent version is 2.2.1
http-proxy-agent version is 2.1.0

very slow and easily throw timeout

const agent1  = tunnel.httpOverHttp({
                                       proxy: {
                                         host: 'xxx.xxx.xxx.xxx',
                                         port: xxxx
                                       }
                                     })
  const agent2  = new ProxyAgent(`http://xxx.xxx.xxx.xxx:xxxx`)
  const result = await check(product, cookie, agent2)

compare with tunnel

using agent2 fails and throw timeout, use agent1 works well, I am using 'got' for now, will test with other http-client module when I get some time.

websocket does not work

I have to use your https-proxy-agent npm package instead of this package.
I found that this npm package use RFC 7230 - HTTP/1.1: Message Syntax and Routing (proxy server emit request event) to handle ws:// (I am not sure if wss:// has the same problem),
your https-proxy-agent npm package use RFC 7231 - HTTP/1.1: Semantics and Content (proxy server emit connect event).

Timeout on proxy connect kills script

I'll apologize in advance, because I hate submitting this kind of an issue - I can't find where the issue is, and it's totally possible that the issue is not with this library, but I'm not sure where to go next and hoping your expertise can help.

Some details:

When the proxy times out trying to connect, my long-running script that's using the AWS SDK just dies. There does not seem to be any error thrown, the SDK doesn't seem to retry, ... nothing. Compare this to if there's an actual error from the AWS API (any API) - I get an error that I can handle and move on. But when one of these proxy timeouts happens, the script dies with no indication of what went wrong.

I've tried the following:

var _ = require('underscore'),
    url = require('url'),
    proxy = require('proxy-agent'),
    awsOpts = {};

// try passing a timeout to the proxy-agent:
// see https://www.npmjs.com/package/agent-base#agentfunction-callback-object-options-→-httpagent
awsOpts.httpOptions = {
   agent: proxy(_.extend(url.parse('http://someproxy:3128'), { timeout: 30000 })),
};

// also try passing timeouts to the AWS options directly:
// see http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#constructor-property
awsOpts.connectTimeout = 30000;
awsOpts.timeout = 45000;

AWS.config.update(awsOpts);

Do you have any ideas on:

  1. what might be causing this, or
  2. how I could get an event or an error or something that I can log / debug when this happens?, or
  3. anything I might be missing?

socks5 is not working

What the problem with socks5?
My code:
const ProxyAgent = require('proxy-agent');
var proxyUri = 'socks5://login:pass@ip:port';
const httpsAgent = new ProxyAgent(proxyUri)

const cookieJar = new tough.CookieJar();
const request = axios.create({
httpsAgent,
jar: cookieJar,
withCredentials: true,
});

I got an error:
(node:11688) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.
(node:11688) UnhandledPromiseRejectionWarning: Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: IP: 195.201.201.32 is not in the cert's list:

Request to exclude the test ssl key file

It is possible to exclude the SSL key file?
Since security scanner tools like twistlock find it as a compliance issue.

└─┬ test
└─┬ ssl-cert-snakeoil.key

image

Change proxy in ProxyAgent instance

ProxyAgent already handles other agents' instances and is able to instantiate them after its own construction. Can we make a proxy switchable in ProxyAgent instance?

So an instance could created, passed as agent to request library of choice and still able to change proxy URI on the fly.

In its most simple form it may be like that.

class SwitchableProxyAgent extends ProxyAgent {
    get proxyUri() {
        return this._uri;
    }

    set proxyUri(uri) {
        this._uri = uri;
        this.proxy = url.parse(uri);
    }
}

A few problems persist with extending existing ProxyAgent

  • original opts object isn't reusable after construction, there's no way to tell from this.proxy if the option is there on purpose (like opts.secureEndpoint) or it was parsed from URI
  • custom proxy types are private and cannot be reached from outside the constructor (incidentally, they were available once)
  • the only way to switch proxy type (proxyFn) after instantiation is to recreate the whole constructor logic

This could be fixed by exposing this.opts and this.proxies and moving almost all constructor code to something like this.setProxyUri (proxyUri accessors would be ok, too). BTW, this may improve unit-testability.

Just a QnA 101 question

Previously, I was using environment variables to set up proxy.
Such as http_proxy and https_proxy.
Since we have to configure proxy in nodejs, this proxy-agent module comes into our scope.

I am wondering how we do the same settings with proxy-agent to set up http_proxy and https_proxy

pac proxies trigger error about object is not a function

While using a http, https or socks proxy works fine, if the url is a .pac file, it seems trigger an error in pac-proxy-agent - where it tries to use proxy-agent to figure out the correct final proxy agent to use.

I've enabled debug using and I see this trace:

  pac-proxy-agent loading PAC file: "http://proxy/proxy.pac" +0ms
  pac-proxy-agent got stream.Readable instance for URI +10ms
  pac-proxy-agent read 6412 byte PAC file from URI +2ms
  pac-proxy-agent creating new proxy resolver instance +0ms
  pac-proxy-agent url: "https://demo.stwc.s3group.com/api/v1/login", host: "demo
.stwc.s3group.com" +231ms
  pac-proxy-agent using proxy: "PROXY avproxylan.dublin.s3group.com:8080" +3ms

c:\Users\markcu\Documents\WarningCenter\git\warningcenter\wsagents\s3_modules\pr
oxy\node_modules\proxy-agent\node_modules\pac-proxy-agent\index.js:243
      agent = ProxyAgent('http://' + parts[1], secure);
              ^
TypeError: object is not a function
    at onproxy (c:\Users\markcu\Documents\WarningCenter\git\warningcenter\wsagen
ts\s3_modules\proxy\node_modules\proxy-agent\node_modules\pac-proxy-agent\index.
js:243:15)
    at processImmediate [as _immediateCallback] (timers.js:345:15)

I can install pac-proxy-agent and use it directly and I do not get this error.

http-proxy-agent sends incomplete multipart data when proxy is resolved via pac-proxy-agent

I am using superagent (6.1.0) module to invoke REST API. One of the API uploads a zip file. When I test by passing http proxy, it goes through fine. But when I use PAC proxy (proxy Auto config), superagent first uses pac-proxy-agent to resovle the proxy to be used, which happens to be the same http proxy and then uses http-proxy-agent to perform the request.. This time, the API fails with error 'Unexpected end of MIME multipart stream. MIME multipart message is not complete.'

Below are the logs with HTTP Proxy:
D:\testnodejs>node pproxytest.js
superagent creating fs.ReadStream instance for file: D:\F\workspace\Java\tutorials-master\tutorials-master\algorithms\src\main.zip +0ms
superagent-proxy Request#proxy('http://10.32.2.169:808') +0ms
superagent-proxy patched superagent Request "url" property for changes +1ms
proxy-agent creating new ProxyAgent instance: 'http://10.32.2.169:808' +0ms
agent-base Converting legacy callback function to promise +0ms
agent-base Resolving socket for 'http:' request: 'POST /ABC/projects/10058/sourceCode/attachments' +0ms
http-proxy-agent Creating new HttpProxyAgent instance: Url { protocol: 'http:', slashes: true, auth: null, host: '10.32.2.169:808', port: '808', hostname: '10.32.2.169', hash: null, search: null, query: null, pathname: '/', path: '/', href: 'http://10.32.2.169:808/' } +0ms
http-proxy-agent Creating net.Socket: { protocol: 'http:', slashes: true, auth: null, host: '10.32.2.169', port: 808, hostname: '10.32.2.169', hash: null, search: null, query: null, href: 'http://10.32.2.169:808/' } +1ms
superagent POST http://api.example.com/ABC/projects/10058/sourceCode/attachments +12ms
superagent setting FormData header: "content-type: multipart/form-data; boundary=--------------------------630107661057145674080211" +0ms
superagent got FormData Content-Length: 24880 +4ms
superagent POST http://api.example.com/ABC/projects/10058/sourceCode/attachments -> 204 +859ms
<ref *2> Response {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
res: <ref *1> IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: true,
decoder: [StringDecoder],
encoding: 'utf8',
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
end: [Array],
data: [Array],
error: [Array],
close: [Function: bound emit]
},
_eventsCount: 4,
_maxListeners: undefined,
socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
[Symbol(async_id_symbol)]: 7,
[Symbol(kHandle)]: [TCP],
[Symbol(kSetNoDelay)]: true,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(RequestTimeout)]: undefined
},
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: {
'cache-control': 'no-cache',
pragma: 'no-cache',
expires: '-1',
server: 'Microsoft-IIS/8.5',
'api-version': '1.0',
'x-aspnet-version': '4.0.30319',
'x-powered-by': 'ASP.NET',
date: 'Thu, 11 Feb 2021 13:51:51 GMT',
connection: 'close'
},
rawHeaders: [
'Cache-Control',
'no-cache',
'Pragma',
'no-cache',
'Expires',
'-1',
'Server',
'Microsoft-IIS/8.5',
'api-version',
'1.0',
'X-AspNet-Version',
'4.0.30319',
'X-Powered-By',
'ASP.NET',
'Date',
'Thu, 11 Feb 2021 13:51:51 GMT',
'Connection',
'close'
],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 204,
statusMessage: 'No Content',
client: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
[Symbol(async_id_symbol)]: 7,
[Symbol(kHandle)]: [TCP],
[Symbol(kSetNoDelay)]: true,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(RequestTimeout)]: undefined
},
_consuming: false,
_dumped: false,
req: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Socket],
_header: 'POST http://api.example.com/ABC/projects/10058/sourceCode/attachments HTTP/1.1\r\n' +
'Host: api.example.com\r\n' +
'Accept-Encoding: gzip, deflate\r\n' +
'Accept: application/json\r\n' +
'Authorization: Bearer accesstoken\r\n' +
'content-type: multipart/form-data; boundary=--------------------------630107661057145674080211\r\n' +
'Content-Length: 24880\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [ProxyAgent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: 'http://api.example.com/ABC/projects/10058/sourceCode/attachments',
_ended: true,
res: [Circular *1],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'api.example.com',
protocol: 'http:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
text: '',
[Symbol(kCapture)]: false,
[Symbol(RequestTimeout)]: undefined
},
request: Request {
_events: [Object: null prototype] { abort: [Function (anonymous)] },
_eventsCount: 1,
_maxListeners: undefined,
_enableHttp2: false,
_agent: ProxyAgent {
proxy: [Url],
proxyUri: 'http://10.32.2.169:808',
proxyFn: [Function: httpOrHttpsProxy],
promisifiedCallback: [Function (anonymous)]
},
_formData: FormData {
_overheadLength: 264,
_valueLength: 5,
_valuesToMeasure: [Array],
writable: false,
readable: true,
dataSize: 0,
maxDataSize: 2097152,
pauseStreams: true,
_released: true,
_streams: [],
_currentStream: null,
_insideLoop: false,
_pendingNext: false,
_events: [Object: null prototype],
_eventsCount: 1,
_boundary: '--------------------------630107661057145674080211'
},
method: 'POST',
url: [Getter/Setter],
_header: {
accept: 'application/json',
authorization: 'Bearer accesstoken'
},
header: {
Accept: 'application/json',
Authorization: 'Bearer accesstoken'
},
writable: true,
_redirects: 0,
_maxRedirects: 5,
cookies: '',
qs: {},
_query: [],
qsRaw: [],
_redirectList: [],
_streamRequest: false,
_url: 'http://api.example.com/ABC/projects/10058/sourceCode/attachments',
_proxyUri: 'http://10.32.2.169:808',
req: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Socket],
_header: 'POST http://api.example.com/ABC/projects/10058/sourceCode/attachments HTTP/1.1\r\n' +
'Host: api.example.com\r\n' +
'Accept-Encoding: gzip, deflate\r\n' +
'Accept: application/json\r\n' +
'Authorization: Bearer accesstoken\r\n' +
'content-type: multipart/form-data; boundary=--------------------------630107661057145674080211\r\n' +
'Content-Length: 24880\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [ProxyAgent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: 'http://api.example.com/ABC/projects/10058/sourceCode/attachments',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'api.example.com',
protocol: 'http:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
protocol: 'http:',
host: 'api.example.com',
_endCalled: true,
_callback: [Function (anonymous)],
_fullfilledPromise: Promise { [Circular *2] },
res: <ref *1> IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
socket: [Socket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 204,
statusMessage: 'No Content',
client: [Socket],
_consuming: false,
_dumped: false,
req: [ClientRequest],
text: '',
[Symbol(kCapture)]: false,
[Symbol(RequestTimeout)]: undefined
},
_resBuffered: true,
response: [Circular *2],
called: true,
[Symbol(kCapture)]: false
},
req: <ref *3> ClientRequest {
_events: [Object: null prototype] {
error: [Function (anonymous)],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 2,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Circular *3],
[Symbol(async_id_symbol)]: 7,
[Symbol(kHandle)]: [TCP],
[Symbol(kSetNoDelay)]: true,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(RequestTimeout)]: undefined
},
_header: 'POST http://api.example.com/ABC/projects/10058/sourceCode/attachments HTTP/1.1\r\n' +
'Host: api.example.com\r\n' +
'Accept-Encoding: gzip, deflate\r\n' +
'Accept: application/json\r\n' +
'Authorization: Bearer accesstoken\r\n' +
'content-type: multipart/form-data; boundary=--------------------------630107661057145674080211\r\n' +
'Content-Length: 24880\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: ProxyAgent {
proxy: [Url],
proxyUri: 'http://10.32.2.169:808',
proxyFn: [Function: httpOrHttpsProxy],
promisifiedCallback: [Function (anonymous)]
},
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: 'http://api.example.com/ABC/projects/10058/sourceCode/attachments',
_ended: true,
res: <ref *1> IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
socket: [Socket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 204,
statusMessage: 'No Content',
client: [Socket],
_consuming: false,
_dumped: false,
req: [Circular *3],
text: '',
[Symbol(kCapture)]: false,
[Symbol(RequestTimeout)]: undefined
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'api.example.com',
protocol: 'http:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
host: [Array],
'accept-encoding': [Array],
accept: [Array],
authorization: [Array],
'content-type': [Array],
'content-length': [Array]
}
},
text: '',
body: {},
files: undefined,
buffered: true,
headers: {
'cache-control': 'no-cache',
pragma: 'no-cache',
expires: '-1',
server: 'Microsoft-IIS/8.5',
'api-version': '1.0',
'x-aspnet-version': '4.0.30319',
'x-powered-by': 'ASP.NET',
date: 'Thu, 11 Feb 2021 13:51:51 GMT',
connection: 'close'
},
header: {
'cache-control': 'no-cache',
pragma: 'no-cache',
expires: '-1',
server: 'Microsoft-IIS/8.5',
'api-version': '1.0',
'x-aspnet-version': '4.0.30319',
'x-powered-by': 'ASP.NET',
date: 'Thu, 11 Feb 2021 13:51:51 GMT',
connection: 'close'
},
statusCode: 204,
status: 204,
statusType: 2,
info: false,
ok: true,
redirect: false,
clientError: false,
serverError: false,
error: false,
created: false,
accepted: false,
noContent: true,
badRequest: false,
unauthorized: false,
notAcceptable: false,
forbidden: false,
notFound: false,
unprocessableEntity: false,
type: '',
links: {},
setEncoding: [Function: bound ],
redirects: [],
pipe: [Function (anonymous)],
[Symbol(kCapture)]: false
}
Below are the logs with PAC Proxy:

D:\testnodejs>node pproxytest.js
superagent creating fs.ReadStream instance for file: D:\F\workspace\Java\tutorials-master\tutorials-master\algorithms\src\main.zip +0ms
superagent-proxy Request#proxy('pac+http://localhost:6080/examples/proxy.pac') +0ms
superagent-proxy patched superagent Request "url" property for changes +1ms
proxy-agent creating new ProxyAgent instance: 'pac+http://localhost:6080/examples/proxy.pac' +0ms
agent-base Converting legacy callback function to promise +0ms
agent-base Resolving socket for 'http:' request: 'POST /ABC/projects/10058/sourceCode/attachments' +1ms
pac-proxy-agent Creating PacProxyAgent with URI 'pac+http://localhost:6080/examples/proxy.pac' and options Url { protocol: 'pac+http:', slashes: true, auth: null, host: 'localhost:6080', port: '6080', hostname: 'localhost', hash: null, search: null, query: null, pathname: '/examples/proxy.pac', path: '/examples/proxy.pac', href: 'pac+http://localhost:6080/examples/proxy.pac' } +0ms
pac-proxy-agent Loading PAC file: 'http://localhost:6080/examples/proxy.pac' +2ms
get-uri getUri('http://localhost:6080/examples/proxy.pac') +0ms
get-uri:http GET 'http://localhost:6080/examples/proxy.pac' +0ms
get-uri:http allowing 5 max redirects +1ms
get-uri:http using http core module +0ms
superagent POST http://api.example.com/ABC/projects/10058/sourceCode/attachments +14ms
superagent setting FormData header: "content-type: multipart/form-data; boundary=--------------------------148489407975531565009366" +0ms
superagent got FormData Content-Length: 24880 +5ms
get-uri:http got 200 response status code +14ms
pac-proxy-agent Got Readable instance for URI +16ms
pac-proxy-agent Read 129 byte PAC file from URI +1ms
pac-proxy-agent Creating new proxy resolver instance +1ms
pac-proxy-agent url: 'http://api.example.com/ABC/projects/10058/sourceCode/attachments' +8ms
pac-proxy-agent Attempting to use proxy: 'PROXY 10.32.2.169:808' +0ms
http-proxy-agent Creating new HttpProxyAgent instance: { protocol: 'http:', slashes: true, auth: null, host: '10.32.2.169:808', port: '808', hostname: '10.32.2.169', hash: null, search: null, query: null, pathname: '/', path: '/', href: 'http://10.32.2.169:808/', filename: 'pac+http://localhost:6080/examples/proxy.pac' } +0ms
http-proxy-agent Creating net.Socket: { protocol: 'http:', slashes: true, auth: null, host: '10.32.2.169', port: 808, hostname: '10.32.2.169', hash: null, search: null, query: null, href: 'http://10.32.2.169:808/', filename: 'pac+http://localhost:6080/examples/proxy.pac' } +0ms
http-proxy-agent Regenerating stored HTTP header string for request +1ms
http-proxy-agent Patching connection write() output buffer with updated header +1ms
http-proxy-agent Output buffer: 'POST http://api.example.com/ABC/projects/10058/sourceCode/attachments HTTP/1.1\r\n' + 'Host: api.example.com\r\n' + 'Accept-Encoding: gzip, deflate\r\n' + 'Accept: application/json\r\n' + 'Authorization: Bearer accesstoken\r\n' + 'content-type: multipart/form-data; boundary=--------------------------148489407975531565009366\r\n' + 'Content-Length: 24880\r\n' + 'Connection: close\r\n' + '\r\n' +0ms
superagent POST http://api.example.com/ABC/projects/10058/sourceCode/attachments -> 500 +878ms
(node:22468) UnhandledPromiseRejectionWarning: Error: Internal Server Error
at Request.callback (D:\testnodejs\node_modules\superagent\lib\node\index.js:883:15)
at D:\testnodejs\node_modules\superagent\lib\node\index.js:1127:20
at IncomingMessage. (D:\testnodejs\node_modules\superagent\lib\node\parsers\json.js:22:7)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)

Error: Protocol:https: not supported.

suddenly getting this error as of 0.11.12 when i'm proxying https requests over an http proxy. am i doing things wrong? or do you have to change something?

Error: ERR_INVALID_PROTOCOL when using http.globalAgent

Problem

With Node.js version > v10.16.0, code as below will throw error if set http.globalAgent.

RunKit Demo

const http = require('http')
const ProxyAgent = require('proxy-agent')

const proxyUri = process.env.http_proxy || 'http://168.63.43.102:3128'

http.globalAgent = new ProxyAgent(proxyUri)

http.get('http://jsonip.org', onresponse)

function onresponse (res) {
  console.log(res.statusCode, res.headers)
  res.pipe(process.stdout)
}
_http_client.js:119
    throw new ERR_INVALID_PROTOCOL(protocol, expectedProtocol);
    ^

TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "undefined"
    at new ClientRequest (_http_client.js:119:11)
    at request (http.js:42:10)
    at Object.get (http.js:46:13)
    at Object.<anonymous> (/Users/L3au/Program/l3au/assets/index.js:8:6)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)

Still occur if using other request library, e.g. axios, got

axios.get('http://jsonip.org').catch(err => console.error)

Environments

  • Platform: macOS Mojave
  • Node Version: all > v10.16.0
  • proxy-agent: 3.1.0

Details

After Node v10.16.0, through http.globalAgent = agent will overwrite the default http agent and can affect all http requests. Consequently, there is assertion to check agent protocol and request protocol, and will throw ERR_INVALID_PROTOCOL if not match.

node/lib/_http_client.js#L106-L121

var protocol = options.protocol || defaultAgent.protocol;
var expectedProtocol = defaultAgent.protocol;
if (this.agent && this.agent.protocol)
  expectedProtocol = this.agent.protocol;

var path;
if (options.path) {
  path = String(options.path);
  if (INVALID_PATH_REGEX.test(path))
    throw new ERR_UNESCAPED_CHARACTERS('Request path');
}

if (protocol !== expectedProtocol) {
  throw new ERR_INVALID_PROTOCOL(protocol, expectedProtocol);
}

To handle this, the simplest way is to set protocol property to agent instance, just like the internal http.Agent does.

Does it make sense to solve the problem? If do, I can create a PR to deal with it.

After updating to v5.0.0 dist file failed to start

node /server/dist-server/main.js


/server/dist-server/main.js:469819
  __webpack_require__(60863),
                      ^^^^^

SyntaxError: Unexpected number
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE

i am using Angular 11, node 14, webpack v5

Proper Syntax for adding Certifications?

What would be the proper syntax to add certifications to the proxy agent? This does not seem to set the ca value:

const fs = require('fs');
const proxy = require('proxy-agent');

const certs = [
  fs.readFileSync('C:\\Users\\username\\Certificates\\my_pem.pem')
];

AWS.config.update({
  region: 'us-west-1',
  httpOptions: {
    agent: proxy("http://myproxy.com:80/", { ca: certs })
  }
});

so big

screen shot 2014-04-06 at 9 18 09 pm

saw that component is now a 78mb or osmething install. noticed that this libary alone is like 10mb. looks like the main source of the size is regenerator/degenerator's esprima and friends.

would be nice if you could make this smaller or remove those deps

Document opts for constructor

Hi,

Could you provide some documentation for the different object shapes that are available for the new ProxyAgent(opts) constructor?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.