question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RequestError: connect ECONNREFUSED 127.0.0.1:443

See original GitHub issue

Describe the bug

  • Node.js version: 14
  • OS & version: docker/alpine

Using this library through https://github.com/panva/node-openid-client , when making the initial request of the open id connect discovery document it throws this weird error

Actual behavior

2020-12-28T21:49:39.282Z tenx:lib-auth:http >>> Request GET https://private-oidc-provider.com//.well-known/oauth-authorization-server
2020-12-28T21:49:39.282Z tenx:lib-auth:http Headers: {
  'user-agent': 'openid-client', // the one that we use works
  accept: 'application/json',
  'accept-encoding': 'gzip, deflate, br'
}
2020-12-28T21:49:39.282Z tenx:lib-auth:http Body undefined
2020-12-28T21:49:39.283Z tenx:lib-auth:http >>> Request GET https://private-oidc-provider.com/.well-known/openid-configuration
2020-12-28T21:49:39.283Z tenx:lib-auth:http Headers: {
   'user-agent': 'openid-client',// the one that we use works
  accept: 'application/json',
  'accept-encoding': 'gzip, deflate, br'
}
2020-12-28T21:49:39.283Z tenx:lib-auth:http Body undefined
2020-12-28T21:49:39.297Z tenx:lib-auth:init Error creating costar client AggregateError:
    RequestError: connect ECONNREFUSED 127.0.0.1:443
        at ClientRequest.<anonymous> (/usr/src/app/node_modules/got/dist/source/core/index.js:957:25)
        at /usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:68:19
        at Scope._activate (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:44:14)
        at Scope.activate (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:13:17)
        at ClientRequest.<anonymous> (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:67:20)
        at ClientRequest.req.emit (/usr/src/app/node_modules/dd-trace/packages/datadog-plugin-http/src/client.js:93:21)
        at ClientRequest.origin.emit (/usr/src/app/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
    RequestError: connect ECONNREFUSED 127.0.0.1:443
        at ClientRequest.<anonymous> (/usr/src/app/node_modules/got/dist/source/core/index.js:957:25)
        at /usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:68:19
        at Scope._activate (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:44:14)
        at Scope.activate (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:13:17)
        at ClientRequest.<anonymous> (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:67:20)
        at ClientRequest.req.emit (/usr/src/app/node_modules/dd-trace/packages/datadog-plugin-http/src/client.js:93:21)
        at ClientRequest.origin.emit (/usr/src/app/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
    at maybeSettle (/usr/src/app/node_modules/p-some/index.js:31:11)
    at /usr/src/app/node_modules/p-some/index.js:69:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Expected behavior

This request to work.

This request works

  • running the code locally on a lot of developer machines
  • works via curl/wget from inside the Kube cluster node and pods

But it doesn’t work via node-oidc-client and got when running side the pod / container.

Code to reproduce

working on it, but it is hard because it only fails inside the container inside the pod inside the kube cluster

Checklist

  • [ x ] I have read the documentation.
  • [ x ] I have tried my code with the latest version of Node.js and Got.

Also reported in got’s repo https://github.com/sindresorhus/got/issues/1515

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
franleplantcommented, Jan 20, 2021

also when you do any other thing with the library such as fetching user info, refreshing the token et al should get into this error so there’s no easy way around it.

Perhaps this lib could be request-library-agnostic and so if people really want to can replace got for superagent (to say an example).

You can always fork it and do that yourself.

On Wed, Jan 20, 2021 at 1:52 PM agix notifications@github.com wrote:

fetching .well-known endpoints manually

if you use got to fetch it manually (maybe other http library too) it will do the same.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/panva/node-openid-client/issues/320#issuecomment-763780498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOEIJ6X3NYYLQLL73PJSNTS24C4TANCNFSM4VMSHU7A .

1reaction
panvacommented, Dec 29, 2020

Any clues to solve this will be highly appreciated

There is no bug here, you’re simply asking for help diagnosing your environment / build issues. Please open a Q&A discussion instead.

https://github.com/sindresorhus/got/issues/1515 or something similar monkey patching internals is likely the cause. Or just your kubernetes networking setup.

Read more comments on GitHub >

github_iconTop Results From Across the Web

connect ECONNREFUSED" from got when also requiring ...
got("https://google.com") throws RequestError: connect ECONNREFUSED . ... RequestError: connect ECONNREFUSED 127.0.0.1:443 at ClientRequest.
Read more >
Https Request Error: connect ECONNREFUSED 127.0.0.1 ...
So I want to load an image from an external URL. var https = require('node:https'); export const loadImageFromUrl ...
Read more >
"Error: connect ECONNREFUSED 127.0.0.1:443" - Forums
How to fix HTTP Request error: "Error: connect ECONNREFUSED 127.0.0.1:443". I'm trying to make a HTTP Get Request but am getting this error....
Read more >
RequestError: Error: connect ECONNREFUSED 127.0.0.1:3423
Hello Community! I noticed a few threads regarding this error message as referenced in the title, "RequestError: Error: connect ECONNREFUSED 127.0.0.1:3423" ...
Read more >
error: connect econnrefused 127.0.0.1:80 at tcpconnectwrap ...
So better check your URL if are also using axios . Open side panel. AXIOS request: "Error: connect ECONNREFUSED 127.0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found