Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(signup): recover invite signup when a 5xx hid a created account (#65451)

Eleftheria Trivyzakicae6721d5c9c
diff --git a/frontend/src/scenes/authentication/invite-signup/inviteSignupLogic.ts b/frontend/src/scenes/authentication/invite-signup/inviteSignupLogic.ts
index a790e2c0bd3f..afd2f19ba8f8 100644
--- a/frontend/src/scenes/authentication/invite-signup/inviteSignupLogic.ts
+++ b/frontend/src/scenes/authentication/invite-signup/inviteSignupLogic.ts
@@ -189,6 +189,24 @@ export const inviteSignupLogic = kea<inviteSignupLogicType>([
return
}
+ // A 5xx or lost-response (undefined status) submit can still have committed the
+ // account server-side. The invite is deleted in that same transaction, so probe the
+ // email instead (it survives). Reaching this form means prevalidate found no account,
+ // so one existing now was created by this submit — send them to login, not a
+ // misleading signup error.
+ const targetEmail = values.invite?.target_email
+ if ((error.status === undefined || error.status >= 500) && targetEmail) {
+ try {
+ await api.create('api/signup/precheck', { email: targetEmail })
+ } catch (probeError) {
+ const probe = probeError as Record<string, any>
+ if (probe.status === 409 || probe.code === 'account_exists') {
+ location.href = '/login'
+ return
+ }
+ }
+ }
+
actions.resetChallenge()
posthog.captureException(e)
actions.setSignupManualErrors({