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

AggregateError#message from Issuer.discover includes stack trace #236

Merged
merged 2 commits into from
Jan 13, 2021

Conversation

adamjmcgrath
Copy link
Contributor

@adamjmcgrath adamjmcgrath commented Jan 12, 2021

Description

One of the errors thrown by Issuer.discover is an AggregateError, which encapsulates all the errors thrown when the openid-client tries to find a well-known endpoint.

The error.message of the AggregateError includes a \n separated string of a list of the entire errors (String(error)) - stack trace included (See https://github.com/sindresorhus/aggregate-error/blob/v3.1.0/index.js#L26-L31)

In production we don't want to show the stack trace, so the error message in this case needs to be amended. Instead of trying to edit the error message, we're opting for showing the first error in the aggregate, on the assumption that, if all the discovery endpoints fail, the error will be similar for all.

In the long term we should try and fix this in the downstream dependency openid-client > p-any > p-some > aggregate-error

References

sindresorhus/aggregate-error#4 (comment)

Testing

  • Point issuerBaseURL at an https server with invalid certs
  • Visit Login

Before

image

After

image

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

@adamjmcgrath adamjmcgrath requested a review from a team as a code owner January 12, 2021 13:40
@vercel
Copy link

vercel bot commented Jan 12, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/auth0/nextjs-auth0/lxtllphox
✅ Preview: Canceled

[Deployment for 494e70c canceled]

@adamjmcgrath adamjmcgrath merged commit 5c6ef50 into beta Jan 13, 2021
@adamjmcgrath adamjmcgrath deleted the normalize-aggregate-error branch January 13, 2021 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants