© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•6mo ago•
4 replies
nehatkhan

Not getting user exists error when creating user whose email is already there.

hey guys I am getting an strange issue, even when user is registered and am trying to create a new user with the same email, it does give response of user objetc but dont get new user with the new user id in the db. how this is happening, it should give throw user exists error.

export async function createUser(userInputs: CreateUserInputs) {
  // check if the passoword and confirm password match
  if (userInputs.password !== userInputs.confirmPassword) {
    return { success: false, error: true, message: "Passwords do not match" };
  }

  const supabase = await createClient();
  const { data: userData, error } = await supabase.auth.signUp({
    email: userInputs.email as string,
    password: userInputs.password as string,
    options: {
      data: {
        "persona": "CLUB_ADMIN",
        "onboarding_done": false,
        "onboarding_status": "NOT_STARTED" as OnboardingStatusType,
        "stripe_connect_account_id": "",
        "clubId": "", 
        "name": "", 
        "players": [],
        "teams": [],      
      },
    },
  });
  if (error) {
    console.log("Error creating user:", error);
    return {
      success: false,
      error: true,
      message: `User creation failed: ${error.message}`,
    };
  }
  return {
    success: true,
    error: false,
    message:
      "User created successfully, please check your email for verification",
    user: userData.user,
  };
export async function createUser(userInputs: CreateUserInputs) {
  // check if the passoword and confirm password match
  if (userInputs.password !== userInputs.confirmPassword) {
    return { success: false, error: true, message: "Passwords do not match" };
  }

  const supabase = await createClient();
  const { data: userData, error } = await supabase.auth.signUp({
    email: userInputs.email as string,
    password: userInputs.password as string,
    options: {
      data: {
        "persona": "CLUB_ADMIN",
        "onboarding_done": false,
        "onboarding_status": "NOT_STARTED" as OnboardingStatusType,
        "stripe_connect_account_id": "",
        "clubId": "", 
        "name": "", 
        "players": [],
        "teams": [],      
      },
    },
  });
  if (error) {
    console.log("Error creating user:", error);
    return {
      success: false,
      error: true,
      message: `User creation failed: ${error.message}`,
    };
  }
  return {
    success: true,
    error: false,
    message:
      "User created successfully, please check your email for verification",
    user: userData.user,
  };

this is my server actions code creating user.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Hello. Getting "Email already exists" internal server error
SupabaseSSupabase / help-and-questions
7mo ago
Not getting error `User already registered` when using `await supabase.auth.signUp`
SupabaseSSupabase / help-and-questions
3w ago
signUp() - how to show that user already exists
SupabaseSSupabase / help-and-questions
4y ago
Odd Error StorageApiError The resource already exists
SupabaseSSupabase / help-and-questions
4y ago