hotfix(frontend/signup): Add missing createUser() call in password signup (#12287)

Requested by @0ubbe

Password signup was missing the backend `createUser()` call that the
OAuth callback flow already had. This caused `getOnboardingStatus()` to
fail/hang for new users whose backend record didn't exist yet, resulting
in an infinite spinner after account creation.

## Root Cause

| Flow | createUser() | getOnboardingStatus() | Result |
|------|-------------|----------------------|--------|
| OAuth signup |  Called |  Works | Redirects correctly |
| Password signup |  Missing |  Fails/hangs | Infinite spinner |

## Fix

Adds `createUser()` call in `signup/actions.ts` after session is set,
before onboarding status check — matching the OAuth callback pattern.
Includes error handling with Sentry reporting.

## Testing

- Create a new password account → should redirect without spinner
- OAuth signup unaffected (no changes to that flow)

Fixes OPEN-3023

---------

Co-authored-by: Lluis Agusti <hi@llu.lu>
This commit is contained in:
Otto
2026-03-05 08:11:51 +00:00
committed by GitHub
parent b342bfa3ba
commit aa7a2f0a48

View File

@@ -1,10 +1,11 @@
"use server";
import { postV1GetOrCreateUser } from "@/app/api/__generated__/endpoints/auth/auth";
import { getOnboardingStatus, resolveResponse } from "@/app/api/helpers";
import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
import { signupFormSchema } from "@/types/auth";
import * as Sentry from "@sentry/nextjs";
import { isWaitlistError, logWaitlistError } from "../../api/auth/utils";
import { getOnboardingStatus } from "../../api/helpers";
export async function signup(
email: string,
@@ -57,6 +58,17 @@ export async function signup(
await supabase.auth.setSession(data.session);
}
try {
await resolveResponse(postV1GetOrCreateUser());
} catch (createUserError) {
console.error("Error creating user during signup:", createUserError);
Sentry.captureException(createUserError);
return {
success: false,
error: "Failed to complete account setup. Please try again.",
};
}
// Get onboarding status from backend (includes chat flag evaluated for this user)
const { shouldShowOnboarding } = await getOnboardingStatus();
const next = shouldShowOnboarding ? "/onboarding" : "/";