fix(db): read invites from primary instead of replica (avoid race condition) #134

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-03-31 19:54:19 +02:00
parent 6ae85a1fe8
commit e58e898683

View File

@@ -133,7 +133,9 @@ export async function connectUserToOrganization({
user: User;
inviteId: string;
}) {
const invite = await db.invite.findUnique({
// Use primary since before this we might have just created the invite
// If we use replica it might not find the invite
const invite = await db.$primary().invite.findUnique({
where: {
id: inviteId,
},