I run puppeteer and after it launch use GOT to send some request
node_modules/got/dist/source/request-as-event-emitter.js:137
Rejected promise returned by test. Reason:
RequestError {
code: 'ECONNREFUSED',
message: 'connect ECONNREFUSED 127.0.0.1:443',
}
onError (node_modules/got/dist/source/request-as-event-emitter.js:137:29)
handleRequest (node_modules/got/dist/source/request-as-event-emitter.js:170:17)
The request will be sent
I create an example repository https://github.com/CrispusDH/puppeteer-got
Here is the single file from it:
import * as puppeteer from 'puppeteer';
import test from 'ava';
import got from "got";
test('example', async () => {
const browser: puppeteer.Browser = await puppeteer.launch(
{
headless: false,
defaultViewport: {
width: 1366,
height:766
}
});
const pages = await browser.pages();
const page = pages[0];
await page.goto('https://github.com/avajs/ava');
await got('https://github.com/avajs/ava');
});
I got the same error even just with only AVA and GOT
I have the exact same thing but I don't use puppeteer neither https-proxy-agent...
I got the same error even without puppeteer. Just AVA and GOT:
import test from 'ava';
import got from "got";
test('example', async () => {
await got('https://github.com/avajs/ava');
});
Seeing same issue with got 10.2.2.
I found a thing. Look if like me you are using in your entire repo a version of node-agent-base < 5 with npm ls agent-base
this is my dependencies in package.json
"typescript": "3.7.5",
"ava": "3.0.0",
"@types/node": "13.5.0",
"got": "10.2.2"
I see this issue in 10.3.0 when I run a suite of Mocha tests using Got on Jenkins (node:12.10.0-slim Docker image), but not when I run them on my machine (Ubuntu 18.04) directly, outside of Docker. At first I thought maybe Docker configs were to blame, but nothing in the configs explain the behavior. An older version of these tests using Got 9.6.0 works fine on my machine and in Jenkins.
Update: Since I'm also using the New Relic JS client, I have
โโโฌ [email protected]
โโโฌ [email protected]
โโโ [email protected]
So not being on agent-base < 5 as mentioned by @yovanoc seems to be the root of my issue. When I run locally, New Relic metrics are disabled by default, hence the disparity in my test run on Jenkins.
Forcing my local runs to use New Relic resulted in the same issue, and forcing New Relic to use [email protected] in node_modules saw the issue go away.
This seems to be a known interplay according to this New Relic Node client issue:
https://github.com/newrelic/node-newrelic/issues/316
Puppeteer fixed it in v2.1.0.
Would just like to add that I've run into this issue now as well since updating from 9.6.0 to 10.x. Its impossible for me to move on to versions 10.x because of this issue- I have a monorepo with many libraries depending on different versions of https-proxy-agent. The strange thing is that I've never faced this issue with other request libraries- it really feels like a regression on got's part, even though it apparently isn't.
I see from other issues this is not something you feel the need to resolve from your side, and I respect that. Just thought you should know this is making newer versions a non-starter for me and probably many others.
The strange thing is that I've never faced this issue with other request libraries- it really feels like a regression on got's part, even though it apparently isn't.
Modern problems require modern solutions. The other libraries use Node.js legacy code and sometimes aren't compatible with newer APIs, so the saying doesn't apply here :(
I'm facing this same issue in my project when trying to run a get request on a url
npm ls agent-base
[email protected] /Users/jasfour/Transit/UpdateServiceAlerts
โโโฌ @google-cloud/[email protected]
โ โโโฌ @google-cloud/[email protected]
โ โ โโโฌ [email protected]
โ โ โโโฌ [email protected]
โ โ โโโ [email protected] deduped
โ โโโฌ [email protected]
โ โโโฌ [email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โโโฌ [email protected]
โโโ [email protected]
Seeing the same! I think this should be reopened @szmarczak -
$ npm ls agent-base
[email protected] /my-proj
โโโฌ [email protected]
โโโฌ [email protected]
โโโฌ [email protected]
โโโ [email protected]
โโโฌ [email protected]
โ โโโ [email protected] deduped
โโโฌ [email protected]
โ โโโ [email protected] deduped
โโโฌ [email protected]
โ โโโ [email protected] deduped
โโโฌ [email protected]
โโโ [email protected]
The second I installed pubnub, which uses superagent-proxy and agent-base, it borked.
Have to remove got now as it's incompatible with the rest of the stack.
It should not be reopened, this is not a Got issue!
Most helpful comment
Puppeteer fixed it in
v2.1.0.