Open samkbe opened 1 year ago
Hi @samkbe - thanks for the issue report.
Not sure what is going on here... Is it something you are experiencing repeatably?
If it is at all possible for you to post a distilled reproduction PR, ideally dockerized, or using an SQLite db file (if the issue is replicable using SQLite as your db), it could go a long way towards figuring out what is going on. (The more eyes on the problem, the easier it gets!)
I am using this lib with Postgres with the following settings, and haven't yet seen this issue:
// Session store
const sessionStore = new PrismaSessionStore(
prisma,
{
checkPeriod: 2 * 60 * 1000, //ms
dbRecordIdIsSessionId: true,
dbRecordIdFunction: undefined,
logger:console,
loggerLevel:'log',
}
)
const sessionParams = {
name: 'id', //Be generic here; https://lockmedown.com/securing-node-js-managing-sessions-express-js/
secret: <secret>,
resave: false, //Set to false iff store implements touch()
saveUninitialized: false,
// Cookie security notes:
// https://odino.org/security-hardening-http-cookies/
// https://web.dev/same-site-same-origin/
// https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/
cookie: {
httpOnly: true,
secure: true, // If using https
sameSite: 'strict' as 'strict' | 'lax' | 'none' | boolean | undefined,
maxAge: <MAX_LOGGING_IN_COOKIE_AGE_MS>
},
store: sessionStore,
}
Hello, I am getting an error when trying to add a session in my Postgres DB with my
expiresAt
field I believe.Here is my Session table in my Prisma schema:
Here is the error message I am getting:
I logged the expiresAt variable inside
/Users/eyffan/Desktop/artbox/node_modules/.pnpm/@quixo3+prisma-session-store@3.1.10_tbn7ymyqz2xwexxxhtnbhlklda/node_modules/@quixo3/prisma-session-store/dist/lib/prisma-session-store.js:606:81
And it logs:
Invalid Date
Perhaps I have configured something wrong in my Express-Session middleware regarding cookie expiration time?
Thank you very much for your help!