Skip to content

Scheduling infrastructure for absolutely everyone.

Convert update statement into unique select in getServerSession

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