From 9bd03edac793fb39982fe1695bf4c96533dcfe31 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 14 Oct 2025 07:46:13 +0000 Subject: [PATCH] Handle non-OK send-verification response gracefully cgen-e1be125bc5d64f779ef3c007f05c56f0 --- client/components/onboarding/Welcome.tsx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/client/components/onboarding/Welcome.tsx b/client/components/onboarding/Welcome.tsx index 2910a431..31d2f493 100644 --- a/client/components/onboarding/Welcome.tsx +++ b/client/components/onboarding/Welcome.tsx @@ -103,7 +103,27 @@ export default function Welcome({ .catch(() => ({}) as Record); if (!response.ok) { - throw new Error(payload?.error || "Failed to send verification email"); + // If server returned a manual verification link despite the error, surface it to the user. + const manualLink = + typeof payload?.verificationUrl === "string" ? payload.verificationUrl : null; + + if (manualLink) { + setFallbackVerificationLink(manualLink); + toastWarning({ + title: payload?.message || "Partial failure", + description: + (payload?.error as string) || + "We couldn't send the email automatically; use the manual link below.", + }); + } else { + toastError({ + title: "Verification email failed", + description: payload?.error || payload?.message || "Failed to send verification email", + }); + } + + setIsSendingVerification(false); + return; } const sent = Boolean(payload?.sent);