Getting 401 response on /login NodeJS route, oidc-middleware

When attempting to access the /login route on NodeJS running @okta/oidc-middleware": “^3.0.0”, I get 401 response not the standard 304 with redirect to the login page.

Everything does work correctly on my localhost machine, however when its deployed on a Dev machine it’s where the problem appears.

Looking at the logs I see the following error:

“RequestError”,“stack”:"Error: Request timed out\n at timeoutFn (/usr/src/pace/node_modules/got/index.js:333:53)\n
at asPromise (/usr/src/pace/node_modules/got/index.js:411:18)\n at got
(/usr/src/pace/node_modules/got/index.js:651:10)\n at function) [as get]
(/usr/src/pace/node_modules/got/index.js:669:31)\n at Object.get (/usr/src/pace/node_modules/openid-client/lib/helpers/http.js:15:14)\n at (/usr/src/pace/node_modules/openid-client/lib/issuer.js:207:30)\n
at Object.oidcUtil.createClient.context [as createClient] (
at new ExpressOIDC (/usr/src/pace/node_modules/@okta/oidc-middleware/src/ExpressOIDC.js:147:14)\n at Object.module.exports.setupOktaOIDC

I ran the following code, to make sure the issuer URI is accessible from our Dev machine:

request.get({url: ‘’, json: true }, function (err, response, data ) {
console.log('inside setupOktaOIDC running request.get… ’ + response.statusCode);
log.warn('inside setupOktaOIDC running request.get… ’ + response.statusCode);

I am getting a valid 200 response, as well as a simple curl request returns a correct response as well.

It seems Okta middleware is using “got” nodejs lib for making the actual authentication requests and somehow failing there without much details.

Any direction on how to proceed on figuring out the cause for this would be very helpful.