Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Better error handling for user session (#17753)

Omar López352a6ba8cfb6
diff --git a/packages/features/auth/lib/getServerSession.ts b/packages/features/auth/lib/getServerSession.ts
index fc0e5d54020..df35cb58904 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");