fix(plugin-auth): surface email-send failures instead of swallowing#2354
Merged
Conversation
The verification / password-reset callbacks swallowed every send failure (console.error + return), so signup and the explicit "Resend verification email" endpoint both reported success while no mail was sent — users were left permanently stuck with no signal and no resend that could ever work. - sendVerificationEmail / sendResetPassword now THROW on failure (no email service, template error, or transport status:'failed'). better-auth runs the sendOnSignUp / forget-password paths through runInBackgroundOrAwait (await + catch + log, never rethrow) and the routes return success regardless, so SIGN-UP stays resilient and there is no email-enumeration leak — while the awaited /send-verification-email RESEND now surfaces a real error to the UI. - AuthPlugin boot guard: when verification is required but no email service is registered, log an error at kernel:ready instead of a quiet info line, so the misconfiguration is caught at startup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 10 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Email verification / password-reset callbacks in
AuthManagerswallowed every send failure (console.error+ return), so signup and the explicit "Resend verification email" endpoint both reported success while no mail was sent. Users were left permanently stuck with no signal and no resend that could ever work.Changes
sendVerificationEmail/sendResetPasswordnow throw on failure (no email service, template error, or transportstatus:'failed').sendOnSignUp/ forget-password paths throughrunInBackgroundOrAwait(await + catch + log, never rethrow) and the routes return success regardless → sign-up stays resilient and there's no email-enumeration leak, while the awaited/send-verification-emailresend surfaces a real error to the UI.AuthPluginboot guard: when verification is required but no email service is registered, log an error atkernel:ready(not a quiet info line) so the misconfiguration is caught at startup.Verification
Real
serve-nodeboot: resend with a failing transport → HTTP 500 (was fake success); signup with failing transport → 200 +sys_emailrowstatus=failed(recorded, not swallowed); boot guard fires when verification required & no email service.Cross-repo
Part of the email-verification fix set with
objectstack-ai/cloud(control-plane email wiring) andobjectstack-ai/objectui(verify-screen error state).🤖 Generated with Claude Code