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

I see such error on request "connect ECONNREFUSED 127.0.0.1:443" #1039

Closed
2 tasks done
CrispusDH opened this issue Jan 24, 2020 · 13 comments
Closed
2 tasks done

I see such error on request "connect ECONNREFUSED 127.0.0.1:443" #1039

CrispusDH opened this issue Jan 24, 2020 · 13 comments

Comments

@CrispusDH
Copy link

CrispusDH commented Jan 24, 2020

Describe the bug

I run puppeteer and after it launch use GOT to send some request

  • Node.js version: 13.7.0
  • GOT version: 10.2.2
  • OS & version: macOS Catalina

Actual behavior

  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)

Expected behavior

The request will be sent

Code to reproduce

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');
});

Notes:

  1. Oddly this isn't happening in a stand alone file.
  2. some similar issue but I did not find solution for me:

UPDATE:

I got the same error even just with only AVA and GOT

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.
@yovanoc
Copy link

yovanoc commented Jan 24, 2020

I have the exact same thing but I don't use puppeteer neither https-proxy-agent...

@CrispusDH
Copy link
Author

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');
});

@folkhack
Copy link

Seeing same issue with got 10.2.2.

@yovanoc
Copy link

yovanoc commented Jan 25, 2020

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

npm/make-fetch-happen#17

@CrispusDH
Copy link
Author

this is my dependencies in package.json

    "typescript": "3.7.5",
    "ava": "3.0.0",
    "@types/node": "13.5.0",
    "got": "10.2.2"

@jrnelson90
Copy link

jrnelson90 commented Jan 27, 2020

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.

@jrnelson90
Copy link

jrnelson90 commented Jan 27, 2020

Update: Since I'm also using the New Relic JS client, I have

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:
newrelic/node-newrelic#316

@szmarczak
Copy link
Collaborator

Puppeteer fixed it in v2.1.0.

@lostpebble
Copy link

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.

@szmarczak
Copy link
Collaborator

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 :(

@justinasfour04
Copy link

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]

@perry-mitchell
Copy link

perry-mitchell commented Apr 27, 2020

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.

@szmarczak
Copy link
Collaborator

It should not be reopened, this is not a Got issue!

Repository owner locked as resolved and limited conversation to collaborators Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants