danger-js icon indicating copy to clipboard operation
danger-js copied to clipboard

[BUG] Unable to use `got` or any `got` dependent libraries due to outdated https-proxy-agent

Open locomike opened this issue 3 years ago • 2 comments

Describe the bug I discovered this bug when trying to integrate gitbeaker in my danger script. The error I get when trying to connect to Gitlab with gitbeaker is

Error:  RequestError: connect ECONNREFUSED 127.0.0.1:443
    at ClientRequest.<anonymous> (/Users/miguelcohnen/dev/ixigo/android/node_modules/got/dist/source/core/index.js:956:111)
    at Object.onceWrapper (events.js:520:26)
    at ClientRequest.emit (events.js:412:35)
    at ClientRequest.origin.emit (/Users/miguelcohnen/dev/ixigo/android/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16) {
  code: 'ECONNREFUSED',
  timings: {
    start: 1632510293779,
    socket: 1632510293779,
    lookup: 1632510293780,
    connect: ,
    secureConnect: ,
    upload: undefined,
    response: undefined,
    end: undefined,
    error: 1632510293780,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 1,
      tcp: undefined,
      tls: undefined,
      request: undefined,
      firstByte: undefined,
      download: undefined,
      total: 1
    }
  }
}

gitbeaker uses got package. According to this issue, the problem is an outdated version of https-proxy-agent that is incompatible with Node 10. See https://forums.meteor.com/t/solved-problems-with-using-the-got-http-package/54297 and https://github.com/sindresorhus/got/issues/876#issuecomment-573348808

My Gitlab instance is under a VPN proxy.

To Reproduce Steps to reproduce the behavior:

  1. Integrate got in a danger script.
  2. Try to connect to a Gitlab Service using got that is behind a proxy
  3. Verify an error is thrown RequestError: connect ECONNREFUSED 127.0.0.1:443

Expected behavior

  • After upgrading http(s)-proxu-agent packages, using got to connect to a Gitlab URL behind a VPN proxy works correctly.

** Your Environment**

software version
danger.js 10.6.6
node v14.17.6
npm 6.14.15
Operating System Mac OS

Additional context Add any other context about the problem here.

locomike avatar Sep 25 '21 06:09 locomike

Cool, you're welcome to send a PR 👍🏻

orta avatar Sep 25 '21 07:09 orta

I'm hitting this issue as well, SO glad to find out that I'm not alone.

The version of gitbeaker that does work for me is 14.2.2 (that package is named gitlab though...this is before it became gitbeaker). Looking to use a newer version though, because this older one has horrible TypeScript support.

opensorceror avatar Oct 22 '21 00:10 opensorceror