OPError: expected 200 OK, got: 302 Found, using express-openid-connect

I’m attempting to upgrade an express node app that I have from express-openid-connect@1.0.2 and auth0@2.31.0 to the most recent versions and I’m running into a lot of issues. It’s a bit complicated because I’m attempting to follow some modern auth0 guides but I’m updating an app that I didn’t set up so I apologize if I leave something out.

So far, I’ve done:

The most recent issue I’m having when I attempt to access my express server’s /login route is:

(node:62030) UnhandledPromiseRejectionWarning: AggregateError: Issuer.discover() failed.
    OPError: expected 200 OK, got: 302 Found
    OPError: expected 200 OK, got: 302 Found
    at Function.discover (/Users/anthony/workspace/my-service/node_modules/openid-client/lib/issuer.js:265:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

It’s a pretty cryptic error and I’ve got no idea what’s wrong. I don’t know why I’m getting a 302. The error is here in openid-client. It’s attempting to call two "wellknown url"s

But that’s really all the information I can get out of it. If it matters, I’m running my express server on 8080 and I’m accessing it via a browser at https://localhost/login, and I’m proxying 443 → 8080 via caddy.

Looks like this was the solution: Authorization code flow results in "connect ECONNREFUSED" · Issue #158 · auth0/express-openid-connect · GitHub

Adding the following to my package.json to resolve some conflict in dependencies. This was a very painful bug.

 "resolutions": {
    "agent-base": "^6.0.1"
1 Like

Thanks for sharing that with the rest of community!