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

Error event is not emitted #52

Closed
RodolfoGS opened this issue Jul 10, 2018 · 3 comments
Closed

Error event is not emitted #52

RodolfoGS opened this issue Jul 10, 2018 · 3 comments

Comments

@RodolfoGS
Copy link

I have an error with a proxy (186.121.206.234:1080). This proxy doesn't work, I know, but when I use them with the agent I can't receive any error event. The script only terminate without any error or event.

I extracted the problem in a simple code. I'm using 2.2.1 version of the agent.

var url = require('url');
var https = require('https');
var HttpsProxyAgent = require('https-proxy-agent');

// HTTP/HTTPS proxy to connect to
var proxy = 'http://186.121.206.234:1080';
console.log('using proxy server %j', proxy);

// HTTPS endpoint for the proxy to connect to
var endpoint = 'https://httpbin.org/ip';
console.log('attempting to GET %j', endpoint);
var options = url.parse(endpoint);

// create an instance of the `HttpsProxyAgent` class with the proxy server information
var agent = new HttpsProxyAgent(proxy);
options.agent = agent;

https.get(options, function (res) {
  console.log('"response" event!', res.headers);
  res.pipe(process.stdout);
}).on('error', (e) => {
  console.error(e);
});

And this is a response when I use with the debug flag: DEBUG=* node app.js

using proxy server "http://186.121.206.234:1080"
attempting to GET "https://httpbin.org/ip"
  https-proxy-agent creating new HttpsProxyAgent instance: Url { protocol: 'http:', slashes: true, auth: null, host: '186.121.206.234:1080', port: '1080', hostname: '186.121.206.234', hash: null, search: null, query: null, pathname: '/', path: '/', href: 'http://186.121.206.234:1080/' } +0ms
  https-proxy-agent onend +1s
  https-proxy-agent onclose had error false +1ms
@TooTallNate TooTallNate changed the title Error event is not emmited Error event is not emitted Aug 28, 2019
@chdzma
Copy link

chdzma commented Jul 15, 2021

I have the same problem

Any solution for this?

@pangwa
Copy link

pangwa commented Jun 15, 2022

#46 actually fixes this issue and realy should be merged ASAP. The promise will not be resolved/rejected if connection closes before the proxy request was ready.

@TooTallNate
Copy link
Owner

This module has gone through a large refactor and modernization. I am closing this issue as a bit of house cleaning. If you feel that this issue still exists in the latest release, feel free to open a new issue.

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

No branches or pull requests

4 participants