BA
Better Auth•11mo ago
Ahmed

authClient.organization.create() error, in latest beta

No description
6 Replies
kyle
kyle•11mo ago
I assume you are trying to create a organizaation when the user signs up? You are not providing the user's email, it is not a better-auth error. ex.
// Insert the member
await db.insert(schema.member).values({
id: newID(),
userId: user.id,
organizationId: org.id,
email: user.email,
role: "owner",
createdAt: new Date(),
});
// Insert the member
await db.insert(schema.member).values({
id: newID(),
userId: user.id,
organizationId: org.id,
email: user.email,
role: "owner",
createdAt: new Date(),
});
Ahmed
AhmedOP•11mo ago
hey, thanks for you reply i'm trying to create new org with signed in user.
kyle
kyle•11mo ago
Do you have onboarding or are you trying to make like a Personal organization when they sign up automatically?
Ahmed
AhmedOP•11mo ago
if the user is signed in the email should be inherited from the current user session right ?!
bekacru
bekacru•11mo ago
remove the email field from your schema
Ahmed
AhmedOP•11mo ago
yup now working, silly me 😒 thank you @bekacru

Did you find this page helpful?