diff --git a/packages/auth/events.ts b/packages/auth/events.ts index 2c8c68dd7..7ca77e0f9 100644 --- a/packages/auth/events.ts +++ b/packages/auth/events.ts @@ -13,6 +13,7 @@ import { extractProfileName } from "./providers/oidc/oidc-provider"; export const createSignInEventHandler = (db: Database): Exclude["signIn"] => { return async ({ user, profile }) => { + logger.debug(`SignIn EventHandler for user: ${JSON.stringify(user)} . profile: ${JSON.stringify(profile)}`); if (!user.id) throw new Error("User ID is missing"); const dbUser = await db.query.users.findFirst({ @@ -28,11 +29,13 @@ export const createSignInEventHandler = (db: Database): Exclude { return `\ncaused by ${formatErrorTitle(cause)}\n${formatErrorStack(cause.stack)}${formatErrorCause(cause.cause, iteration + 1)}`; } + if (cause instanceof Object) { + return `\ncaused by ${JSON.stringify(cause)}`; + } + return `\ncaused by ${cause as string}`; };