BryanB
Convex Community16mo ago
5 replies
Bryan

Issue using auth with custom user schema

I have my auth set up with a custom user schema like so..
export default defineSchema({
  ...authTables,
  users: defineTable({
    name: v.string(),
    email: v.string(),
    emailVerificationTime: v.optional(v.number()),
    phone: v.optional(v.string()),
    phoneVerificationTime: v.optional(v.number()),
    isAnonymous: v.optional(v.boolean()),
    password: v.string(),
    profileImageUrl: v.optional(v.string()),
    activePet: v.optional(v.id('pets')),
  }).index('email', ['email']),
});


I'm also returning those fields to the user profile with like so in a CustomPassword file

export default Password<DataModel>({
  profile(params) {
    return {
      name: params.name as string,
      email: params.email as string,
      phone: params.phone as string | undefined,
      password: params.password as string,
    };
  },
});


but upon trying to sign up I'm running into an error (see attachment)

on signup I'm calling this function below

 const onSignUpPress = async () => {
    try {
      const { signingIn } = await signIn('password', {
        name: fullName,
        email: emailAddress,
        password,
        flow: 'signUp',
      });

      // if successfully signed up, navigate to home
      if (signingIn) router.navigate('/');
    } catch (err) {
      console.error('Error signing up: ', err);
    }
  };


Any ideas what might be causing the issue?
Screenshot_2024-09-26_at_10.57.46_PM.png
Was this page helpful?