-
Notifications
You must be signed in to change notification settings - Fork 48
Improve: auth provider check before auth flow #195
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Bug: Missing health check in forgot password action
The forgotPasswordAction doesn't include a health check before calling supabase.auth.resetPasswordForEmail, while all other auth actions (signInAction, signUpAction, signInWithOAuthAction) now check provider health first. This inconsistency means users could attempt password resets when the auth provider is down, leading to confusing failures instead of the clear error message shown for other auth operations.
src/server/auth/auth-actions.ts#L243-L265
dashboard/src/server/auth/auth-actions.ts
Lines 243 to 265 in 920fa60
| export const forgotPasswordAction = actionClient | |
| .schema(forgotPasswordSchema) | |
| .metadata({ actionName: 'forgotPassword' }) | |
| .action(async ({ parsedInput: { email } }) => { | |
| const supabase = await createClient() | |
| const { error } = await supabase.auth.resetPasswordForEmail(email) | |
| if (error) { | |
| l.error( | |
| { | |
| key: 'forgot_password_action:supabase_error', | |
| error, | |
| }, | |
| `Password reset failed: ${error.message || 'Unknown error'}` | |
| ) | |
| if (error.message.includes('security purposes')) { | |
| return returnServerError( | |
| 'Please wait before requesting another password reset.' | |
| ) | |
| } |
Note
Gate all auth actions behind a Supabase auth health check and update tests to mock the health endpoint.
checkAuthProviderHealth()insrc/server/auth/auth-actions.tsto callGET /auth/v1/healthwith timeout and caching; returnsresponse.ok.AUTH_PROVIDER_ERROR_MESSAGEand useencodedRedirect('error', ...)when provider is unhealthy.signInWithOAuthAction,signUpAction,signInAction, andforgotPasswordAction(preservingreturnTowhen applicable).src/__test__/integration/auth.test.ts, mock globalfetchfor the health check and reset per test; remove redundantvi.resetAllMocks()inafterEach.Written by Cursor Bugbot for commit 17596e6. This will update automatically on new commits. Configure here.