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,
  };

this is my server actions code creating user.
Was this page helpful?