Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🐛 Fix issue where space creation fails when creating an account from a social login
Luke Vella482d499278bb
diff --git a/apps/web/src/lib/auth.ts b/apps/web/src/lib/auth.tsindex 0b1123a54..baec8ba41 100644--- a/apps/web/src/lib/auth.ts+++ b/apps/web/src/lib/auth.ts@@ -223,8 +223,17 @@ export const authLib = betterAuth({user: {create: {after: async (user) => {- // create a space for the user- await createSpace({ name: "Personal", ownerId: user.id });+ // check if user exists in prisma+ const existingUser = await prisma.user.findUnique({+ where: {+ id: user.id,+ },+ });++ if (existingUser) {+ // create a space for the user+ await createSpace({ name: "Personal", ownerId: user.id });+ }posthog?.capture({distinctId: user.id,