-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
chore: bump next-auth
#491
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
if (error instanceof AuthError) { | ||
switch (error.type) { | ||
case 'CredentialsSignin': | ||
return 'Invalid credentials.'; | ||
default: | ||
return 'Something went wrong.'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a return type outside of this condition (or in an else
) to catch when error instanceof AuthError
returns false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those errors are thrown further down. It's not the task of the authenticate
method. There are special throws as well that powers redirect()
(used internally by signIn
) which should not be handled and let Next.js/React handle them with their error boundaries.
If the error is an AuthError
, we already know how to handle it.
This PR bumps NextAuth.js to the latest version.
The main noticeable change is cleaner error handling: Whenever a NextAuth.js-induced error happens in a Server Action, we now throw an
AuthError
instance that makes error handling a bit easier.In addition, this new release includes bug fixes. See the release notes: https://github.com/nextauthjs/next-auth/releases/tag/next-auth%405.0.0-beta.4
Slack thread