Skip to content

Conversation

@ben-fornefeld
Copy link
Member

@ben-fornefeld ben-fornefeld commented Nov 24, 2025

Note

Gate all auth actions behind a Supabase auth health check and update tests to mock the health endpoint.

  • Backend
    • Add checkAuthProviderHealth() in src/server/auth/auth-actions.ts to call GET /auth/v1/health with timeout and caching; returns response.ok.
    • Introduce AUTH_PROVIDER_ERROR_MESSAGE and use encodedRedirect('error', ...) when provider is unhealthy.
    • Apply health pre-check to signInWithOAuthAction, signUpAction, signInAction, and forgotPasswordAction (preserving returnTo when applicable).
  • Tests
    • In src/__test__/integration/auth.test.ts, mock global fetch for the health check and reset per test; remove redundant vi.resetAllMocks() in afterEach.

Written by Cursor Bugbot for commit 17596e6. This will update automatically on new commits. Configure here.

@ben-fornefeld ben-fornefeld self-assigned this Nov 24, 2025
@vercel
Copy link

vercel bot commented Nov 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
web Ready Ready Preview Comment Nov 24, 2025 10:14am
web-juliett Ready Ready Preview Comment Nov 24, 2025 10:14am

@ben-fornefeld ben-fornefeld removed their assignment Nov 24, 2025
@ben-fornefeld ben-fornefeld added the improvement Improvements in-code label Nov 24, 2025
Copy link

@cursor cursor bot left a 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

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.'
)
}

Fix in Cursor Fix in Web


@ben-fornefeld ben-fornefeld merged commit d9b7a9a into main Nov 24, 2025
6 checks passed
@ben-fornefeld ben-fornefeld deleted the improve-auth-provider-failing-handling branch November 24, 2025 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvements in-code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants