Skip to content

Commit

Permalink
chore(debugging): logging cookie setting failure message
Browse files Browse the repository at this point in the history
  • Loading branch information
JaleelB committed Jul 30, 2024
1 parent 3a068c3 commit ae361a5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export const lucia = new Lucia(adapter, {
secure: process.env.NODE_ENV === "production",
sameSite: "lax",
path: "/", // Ensure the cookie is available for all paths
domain: process.env.NEXT_PUBLIC_DOMAIN
? env.NEXT_PUBLIC_DOMAIN
: undefined,
// domain: process.env.NEXT_PUBLIC_DOMAIN
// ? env.NEXT_PUBLIC_DOMAIN
// : undefined,
},
},
getUserAttributes: (attributes) => {
Expand All @@ -29,7 +29,6 @@ export const lucia = new Lucia(adapter, {
};
},
});
console.log("lucia", lucia);

export const validateRequest = async (): Promise<
{ user: User; session: Session } | { user: null; session: null }
Expand Down Expand Up @@ -65,8 +64,13 @@ export const validateRequest = async (): Promise<
sessionCookie.attributes,
);
}
} catch {
console.log("error setting cookie:", result);
} catch (error) {
// console.log("error setting cookie:", result);
if (error instanceof Error) {
console.error("error setting cookie: ", error.message);
}

console.log("result of not being able to set cookie:", error);
}
return result;
};
Expand Down

0 comments on commit ae361a5

Please sign in to comment.