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

This commit is contained in:
Omar López authored and GitHub committed 2024-11-19 22:57:37 +00:00
1 parent 997d6a75e8
commit 352a6ba8cf
1 file changed
+10 -6
+10 -6
View File
@@ -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");