The package prisma-session-store
refuses to work
this is my settings
session({
store: new PrismaSessionStore(new PrismaClient(), {
checkPeriod: 2 * 60 * 1000, //ms
dbRecordIdIsSessionId: true,
dbRecordIdFunction: undefined
}),
name: 'sid',
secret: process.env.KEY,
saveUninitialized: true,
resave: true,
cookie: {
path: '/',
httpOnly: true,
secure: process.env.NODE_ENV === 'development' ? false : true,
maxAge: 2 * 60 * 60 * 1000 // ms
}
})
);
and I have this weird error Knowing prisma works perfect outside the package
set(): Error:
Invalid `this.prisma[this.sessionModelName].update()` invocation in
/Users/hossam/wk/pim/node_modules/@quixo3/prisma-session-store/dist/lib/prisma-session-store.js:493:81
490 case 3:
491 _a.trys.push([3, 8, , 9]);
492 if (!(existingSession !== null)) return [3 /*break*/, 5];
→ 493 return [4 /*yield*/, this.prisma[this.sessionModelName].update(
The provided value for the column is too long for the column's type. Column: data
Error:
Invalid `this.prisma[this.sessionModelName].update()` invocation in
/Users/hossam/wk/pim/node_modules/@quixo3/prisma-session-store/dist/lib/prisma-session-store.js:493:81
490 case 3:
491 _a.trys.push([3, 8, , 9]);
492 if (!(existingSession !== null)) return [3 /*break*/, 5];
→ 493 return [4 /*yield*/, this.prisma[this.sessionModelName].update(
The provided value for the column is too long for the column's type. Column: data
at RequestHandler.request (/Users/hossam/wk/pim/node_modules/@prisma/client/runtime/index.js:49022:15)
at async PrismaClient._request (/Users/hossam/wk/pim/node_modules/@prisma/client/runtime/index.js:49919:18)```
The error message says the column value for data
is too long. This is a field on the Session
model, in your schema.prisam
that prisma session store says to create. I think you'll have to make that column larger. I don't know which database your using but here are the docs for a string.
If you set it up like this data String
in your schema.prisma
then check the docs for the default value of string based on your database.
You can add data String @db.VarChar(<insert length here>)
to explicitly set the character length.