Skip to content

fix(plugin-auth): surface email-send failures instead of swallowing#2354

Merged
os-zhuang merged 1 commit into
mainfrom
claude/email-verif-fix
Jun 26, 2026
Merged

fix(plugin-auth): surface email-send failures instead of swallowing#2354
os-zhuang merged 1 commit into
mainfrom
claude/email-verif-fix

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

What

Email verification / password-reset callbacks in AuthManager 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.

Changes

  • sendVerificationEmail / sendResetPassword now throw on failure (no email service, template error, or transport status:'failed').
  • Resilience preserved by better-auth's own structure: it runs the sendOnSignUp / forget-password paths through runInBackgroundOrAwait (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-email resend 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 (not a quiet info line) so the misconfiguration is caught at startup.

Verification

Real serve-node boot: resend with a failing transport → HTTP 500 (was fake success); signup with failing transport → 200 + sys_email row status=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) and objectstack-ai/objectui (verify-screen error state).

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 26, 2026 6:18pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-auth.

10 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/implementation-status.mdx (via @objectstack/plugin-auth)
  • content/docs/concepts/packages.mdx (via @objectstack/plugin-auth)
  • content/docs/getting-started/cli.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/auth-sso.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/authentication.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/kernel-services.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/packages.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/plugins.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/production-readiness.mdx (via @objectstack/plugin-auth)
  • content/docs/releases/v9.mdx (via @objectstack/plugin-auth)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang os-zhuang merged commit 03af498 into main Jun 26, 2026
16 checks passed
@os-zhuang os-zhuang deleted the claude/email-verif-fix branch June 26, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant