fix: Better error handling for user session (#17753)
This commit is contained in:
1 parent
997d6a75e8
commit
352a6ba8cf
1 file changed
+10
-6
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user