Request fails in production on Heroku, works locally

I’m working on a small project using Auth0 in React and Express. Everything is working locally, but in production I’m receiving a server error on the /login/callback route. The error message is “getaddrinfo ENOTFOUND [issuer].well-known”, suggesting there might be a JWT issue, but the /authorize endpoint is working correctly. I’ve double-checked my config, but I’m still at a loss as how to resolve this issue. Thanks.

Hi @jgebel,

Welcome to the Community!

Based on the error getaddrinfo ENOTFOUND [issuer].well-known, it sounds like the app can’t connect to the address the jwksUri. Is there an environment variable set up in Heroku? Perhaps try to console log what the what the jwkUri is being read as by Heroku.

For example, if your checkJwt function looks something like this (from Auth0 Node (Express) API SDK Quickstarts: Authorization ):

const checkJwt = jwt({
  // Dynamically provide a signing key based on the [Key ID]( header parameter ("kid") and the signing keys provided by the JWKS endpoint.
  secret: jwksRsa.expressJwtSecret({
    cache: true,
    rateLimit: true,
    jwksRequestsPerMinute: 5,
    jwksUri: `https://${process.env.AUTH0_DOMAIN}/.well-known/jwks.json`

  // Validate the audience and the issuer.
  audience: process.env.AUTH0_AUDIENCE,
  issuer: `https://${process.env.AUTH0_DOMAIN}/`,
  algorithms: ['RS256']

I’m wondering if Heroku is unable to read the AUTH0_DOMAIN.

I was able to successfully log out the AUTH0_DOMAIN variable, so I know that Heroku is reading it correctly. My call to jwt is basically the same as what you have listed above.

If you have any other suggestions, feel free to let me know, otherwise I may have to try and deploy elsewhere. I appreciate the response!

I see! Makes sense.

Have you tried turning off any hooks/rules to see if something is interrupting the auth pipeline there?

Also, do you see any related logs in your tenant when you attempt to log in?