Failure getting .well-known/jwks.json

I’ve checked out some of the related answers, with no luck finding an answer.
I’m running a Nodejs backend using JsonWebToken.

My issue is that fairly often I’m getting:

JsonWebTokenError: error in secret or public key callback: socket hang up
at .../node_modules/jsonwebtoken/verify.js:96:1

Which seems to be an issue with getting the keys from my jwksUri: https://{myDomain}

It looks like auth0 is not always available at that URL, so I was wondering if there’s anything I could do to prevent this issue.

For the record, I’m using the jwksClient with cache set to true and cacheMaxEntries set to 1000, which should be ok for my current traffic.

Any insight would be much appreciated!

Hi @brianz,

Can you provide us with the date/time of the failed attempts so I can look into it further?

There were a couple of instances, but one that I could find was at:
timestamp: "2021-04-26T15:37:42.025698Z"

Hi @dan.woda,

Any updates on this? I’m also facing the same issue at random occassions. The last time it occurred was at 11:35 AM CST November 12 2021. This is the error that I’m getting:

jwks Fetching signing key for <kid> +0ms
jwks Fetching keys from 'https://{myDomain}' +0ms
jwks Failure: Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketCloseListener (node:_http_client:420:25)
    at TLSSocket.emit (node:events:402:35)
    at TLSSocket.emit (node:domain:475:12)
    at node:net:672:12
    at TCP.done (node:_tls_wrap:580:7) {
  code: 'ECONNRESET'

I’m using both the jsonwebtoken and jwks-rsa libraries to handle the validation of the access token. The issue seems to happen when I call the getSigningKey function from the jwks-rsa library.

Hi @ale.ferrera,

Are you still experiencing this issue? I don’t see any incidents on our side related to this.