diff --git a/packages/features/auth/lib/getServerSession.ts b/packages/features/auth/lib/getServerSession.ts index fc0e5d5402..df35cb5890 100644 --- a/packages/features/auth/lib/getServerSession.ts +++ b/packages/features/auth/lib/getServerSession.ts @@ -54,12 +54,16 @@ export async function getServerSession(options: { return cachedSession; } - const userFromDb = await prisma.user.update({ - where: { - email: token.email.toLowerCase(), - }, - data: { lastActiveAt: new Date() }, - }); + const email = token.email.toLowerCase(); + const userFromDb = await prisma.user + .update({ + where: { email }, + data: { lastActiveAt: new Date() }, + }) + .catch(() => { + log.debug("No user found for email: ", email); + return null; + }); if (!userFromDb) { log.debug("No user found");