Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to catch Issuer.discover failure? #370

Closed
austinjreid opened this issue Jun 25, 2022 · 1 comment · Fixed by #371
Closed

How to catch Issuer.discover failure? #370

austinjreid opened this issue Jun 25, 2022 · 1 comment · Fixed by #371

Comments

@austinjreid
Copy link

austinjreid commented Jun 25, 2022

Describe the problem

How do I catch an error when the OP is not available?

I receive this error in the console and the application crashes:

AggregateError: Issuer.discover() failed.
    RequestError: connect ECONNREFUSED 127.0.0.1:8024
    RequestError: connect ECONNREFUSED 127.0.0.1:8024
    at Function.discover (E:\code\app1\node_modules\openid-client\lib\issuer.js:265:17)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at pReflect (E:\code\app1\node_modules\p-reflect\index.js:5:17)
    at async Promise.all (index 0)
    at E:\code\app1\node_modules\p-memoize\index.js:33:22
    at get (E:\code\app1\node_modules\express-openid-connect\lib\client.js:43:18)
    at pReflect (E:\code\app1\node_modules\p-reflect\index.js:5:17)
    at async Promise.all (index 0)
    at get (E:\code\app1\node_modules\p-memoize\index.js:33:22)

Thanks for any help!

What was the expected behavior?

I would expect to be able to catch the error in the application and handle it accordingly.

Reproduction

Use example app, take OP offline, attempt authentication

Environment

express-openid-connect: 2.7.2
node: 16.15.1

@adamjmcgrath
Copy link
Contributor

Thanks for raising this @austinjreid

Opened #371 to fix, which should surface the error in your express error handler https://expressjs.com/en/guide/error-handling.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants