Skip to content

Commit 1999a20

Browse files
committed
feat(AuthjsAuthStrategy): Log a warning if user not found in the database but has an valid authjs session
1 parent d9c5895 commit 1999a20

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/payload-authjs/src/payload/AuthjsAuthStrategy.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ export function AuthjsAuthStrategy(
4949
})
5050
).docs.at(0);
5151

52+
// If user does not exist in the database, log a warning and return null user
5253
if (!payloadUser) {
54+
payload.logger.warn(
55+
{ name: "payload-authjs (AuthjsAuthStrategy)", session },
56+
`User '${session.user.id ?? session.user.email}' has a valid Auth.js session but does not exist in the payload database.`,
57+
);
5358
return { user: null };
5459
}
5560

0 commit comments

Comments
 (0)