Unable to register the client, Unexpected error: connect ECONNREFUSED 127.0.0.1:443

Expected behavior

Access Forest Admin in the development environment after migrating to forest-express-sequelize@7

Actual behavior

After upgrading from v6 to v7, there was no issue running our application locally.

However, when trying to access the Development environment with v7 installed, I’m seeing an error “Please verify that your admin backend is correctly configured and running and that you have access to the internet.” (Staging and Production environments that have v6 installed work fine.)

Failure Logs

[forest] 🌳🌳🌳  Unable to register the client
{
  "configuration": {
    "authorization_endpoint": "https://api.forestadmin.com/oidc/auth",
    "device_authorization_endpoint": "https://api.forestadmin.com/oidc/device/auth",
    "claims_parameter_supported": false,
    "claims_supported": [
      "sub",
      "email",
      "sid",
      "auth_time",
      "iss"
    ],
    "code_challenge_methods_supported": [
      "S256"
    ],
    "end_session_endpoint": "https://api.forestadmin.com/oidc/session/end",
    "grant_types_supported": [
      "authorization_code",
      "urn:ietf:params:oauth:grant-type:device_code"
    ],
    "id_token_signing_alg_values_supported": [
      "HS256",
      "RS256"
    ],
    "issuer": "https://api.forestadmin.com",
    "jwks_uri": "https://api.forestadmin.com/oidc/jwks",
    "registration_endpoint": "https://api.forestadmin.com/oidc/reg",
    "response_modes_supported": [
      "query"
    ],
    "response_types_supported": [
      "code",
      "none"
    ],
    "scopes_supported": [
      "openid",
      "email",
      "profile"
    ],
    "subject_types_supported": [
      "public"
    ],
    "token_endpoint_auth_methods_supported": [
      "none"
    ],
    "token_endpoint_auth_signing_alg_values_supported": [],
    "token_endpoint": "https://api.forestadmin.com/oidc/token",
    "request_object_signing_alg_values_supported": [
      "HS256",
      "RS256"
    ],
    "request_parameter_supported": false,
    "request_uri_parameter_supported": true,
    "require_request_uri_registration": true,
    "claim_types_supported": [
      "normal"
    ]
  },
  "registration": {
    "redirect_uris": [
      "https://curator.dev.fini.city/forest/authentication/callback"
    ],
    "token_endpoint_auth_method": "none"
  },
  "error": {
    "name": "RequestError",
    "code": "ECONNREFUSED",
    "timings": {
      "start": 1625004988185,
      "socket": 1625004988186,
      "lookup": 1625004988186,
      "error": 1625004988186,
      "phases": {
        "wait": 1,
        "dns": 0,
        "total": 1
      }
    }
  },
  "signalfx": {
    "trace_id": "155c8703fe13a9ea",
    "span_id": "284269446ce76e9a",
    "service": "curator"
  }
}
Direct call to response.status(...) with 400+ status. Please use the Finicity Error middleware `response.sendFinError(...)`.
[forest] 🌳🌳🌳  Unexpected error: connect ECONNREFUSED 127.0.0.1:443
{
  "name": "RequestError",
  "code": "ECONNREFUSED",
  "timings": {
    "start": 1625004988185,
    "socket": 1625004988186,
    "lookup": 1625004988186,
    "error": 1625004988186,
    "phases": {
      "wait": 1,
      "dns": 0,
      "total": 1
    }
  },
  "stack": "RequestError: connect ECONNREFUSED 127.0.0.1:443\n    at ClientRequest.<anonymous> (/home/node/app/node_modules/openid-client/node_modules/got/dist/source/core/index.js:956:111)\n    at Object.onceWrapper (events.js:421:26)\n    at /home/node/app/node_modules/signalfx-tracing/src/scope/new/base.js:48:19\n    at Scope._activate (/home/node/app/node_modules/signalfx-tracing/src/scope/new/scope.js:45:14)\n    at Scope.activate (/home/node/app/node_modules/signalfx-tracing/src/scope/new/base.js:13:17)\n    at ClientRequest.<anonymous> (/home/node/app/node_modules/signalfx-tracing/src/scope/new/base.js:47:20)\n    at ClientRequest.emit (events.js:326:22)\n    at ClientRequest.EventEmitter.emit (domain.js:483:12)\n    at ClientRequest.req.emit (/home/node/app/node_modules/signalfx-tracing/src/plugins/http/client.js:98:21)\n    at ClientRequest.origin.emit (/home/node/app/node_modules/openid-client/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)\n    at TLSSocket.socketErrorListener (_http_client.js:427:9)\n    at TLSSocket.emit (events.js:326:22)\n    at TLSSocket.EventEmitter.emit (domain.js:483:12)\n    at emitErrorNT (internal/streams/destroy.js:92:8)\n    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n    at processTicksAndRejections (internal/process/task_queues.js:84:21)\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)",
  "signalfx": {
    "trace_id": "155c8703fe13a9ea",
    "span_id": "5cf88907db38c695",
    "service": "curator"
  }
}

The failing network call:


And its response:

Context

Currently our APPLICATION_URL is set to https://curator.dev.fini.city in the development environment.
We have not set a value currently for FOREST_CLIENT_ID.

I have read several other community posts with the same “Unable to register client, ECONNREFUSED 127.0.0.1:443” issue – it seems like the problem for everyone else was caused by a third party library.

^ I tried running ‘npm ls agent-base’ and it came up empty. I saw other posts where their problem was solved by removing @google/maps, or google-auth-library – though our project does not have those packages.

Can you help us determine if this is a problem within our application, or is error caused by a third party package (and possibly what that may be)?

The biggest confusion is that it’s working locally but not on the development environment.

Thank you very much in advance!

  • Package Version: 7.11.3
  • Express Version: 4.17.1
  • Sequelize Version: 6.5.0
  • Project Name: Curator

Hello @rwinz,

Some other users reported the same problem than yours on the v7, and it was caused by a third-party package that was interfering with HTTP requests.

Can you please share with us the list of other packages that your application is depending on?

Here are other topics covering the same issue:

1 Like

Hi @GuillaumeGautreau, thank you for your assistance.

Here is an excerpt from our application’s package.json showing the packages we are using

"dependencies": {
    "@finicity/aws-secrets": "^3.1.0",
    "@finicity/express": "^8.1.0",
    "@finicity/public-constants": "^2.1.2",
    "@sendgrid/client": "^7.4.2",
    "aws-sdk": "^2.845.0",
    "bluebird": "^3.7.2",
    "celebrate": "^13.0.4",
    "chalk": "^4.1.1",
    "config": "^3.3.1",
    "cookie-parser": "1.4.4",
    "cors": "2.8.5",
    "debug": "^4.3.1",
    "dotenv": "~6.1.0",
    "express": "^4.17.1",
    "express-jwt": "^6.0.0",
    "forest-express-sequelize": "^7.11.3",
    "helmet": "^3.23.3",
    "joi": "^17.4.0",
    "morgan": "1.9.1",
    "mysql2": "~1.7.0",
    "parse-domain": "^3.0.3",
    "request": "^2.88.2",
    "request-promise-native": "^1.0.9",
    "require-all": "^3.0.0",
    "s": "^1.0.0",
    "sequelize": "^6.5.0",
    "sequelize-cli": "^6.2.0",
    "signalfx-collect": "^2.0.0-beta3",
    "signalfx-tracing": "^0.12.0",
    "swagger-ui-express": "^4.1.6",
    "uuid": "^8.3.2"
  },
  "devDependencies": {
    "@types/bluebird": "^3.5.35",
    "@types/body-parser": "^1.19.0",
    "@types/chai": "^4.2.18",
    "@types/cookie-parser": "^1.4.2",
    "@types/cors": "^2.8.10",
    "@types/express": "^4.17.12",
    "@types/express-jwt": "^6.0.1",
    "@types/helmet": "^4.0.0",
    "@types/mocha": "^8.2.2",
    "@types/mock-require": "^2.0.0",
    "@types/morgan": "^1.9.2",
    "@types/request-promise-native": "^1.0.17",
    "@types/require-all": "^3.0.2",
    "@types/sinon": "^10.0.2",
    "@types/supertest": "^2.0.11",
    "@types/swagger-ui-express": "^4.1.2",
    "@types/uuid": "^8.3.0",
    "@types/validator": "^13.1.3",
    "chai": "^4.3.4",
    "eslint": "^7.28.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-no-only-tests": "^2.6.0",
    "eslint-plugin-prettier": "^3.4.0",
    "mocha": "^9.0.0",
    "mock-require": "^3.0.3",
    "nodemon": "^2.0.7",
    "npm-force-resolutions": "0.0.10",
    "nyc": "^15.1.0",
    "prettier": "^2.3.1",
    "sequelize-mock": "^0.10.2",
    "sinon": "^11.1.1",
    "supertest": "^6.1.3",
    "typescript": "^4.3.2"
  },
  "resolutions": {
    "lodash": "4.17.21",
    "y18n": "5.0.5"
  },

Hello, can you please try to deactivate signalfx-tracing? It seems to be present in the stack trace, and seems to be a good candidate.

You can also try deactivating signalfx-collect.

Hi, thank you for the suggestion, it turns out that signalfx-tracing was in fact causing this issue.

Unfortunately, signalfx-tracing is critical in our application and we are already on the latest version. I have already reached out to them, but I just thought I’d ask – is updating/removing that package the only solution here?

Thanks again for your help, much appreciated!

Unfortunately, forest-express-sequelize depends on openid-client which depends on got, and the interaction is between got and signalfx-tracing.

Other providers updated their packages, datadog with dd-trace for instance, to fix this issue. I think that the problem comes from signalfx-tracing and they have to fix it.

Okay, thanks again for your help!