prisma-session-store: Incompatible instance typing while assigning to express-session's store
Got an incompatible instance typing while assigning to express-session’s store with the 3.1.10 release as follows:
src/main.ts:48:7 - error TS2740: Type 'PrismaSessionStore<"session">' is missing the following properties from type 'Store': regenerate, load, createSession, addListener, and 14 more.
48 store: new PrismaSessionStore(prismaService, {
~~~~~
node_modules/@types/express-session/index.d.ts:94:9
94 store?: Store | undefined;
~~~~~
The expected type comes from property 'store' which is declared here on type 'SessionOptions'
src/main.ts:
app.use(
expressSession({
secret: 'very-confidential-secret',
resave: false,
saveUninitialized: false,
store: new PrismaSessionStore(prismaService, {
checkPeriod: 2 * 60 * 1000, //ms
dbRecordIdIsSessionId: true,
dbRecordIdFunction: undefined,
}),
})
);
package.json:
{
"dependencies": {
"@quixo3/prisma-session-store": "^3.1.9",
"express-session": "^1.17.3",
}
}
These configurations work just fine before with the 3.1.9 release. Is there anything needs to be done or are there any migration steps should be followed in order to make it works with the latest release?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 21 (10 by maintainers)
I’m getting a similar error, this is my setup:
and TypeScript is throwing this error:
I only have the issue with the typing error and “session” when the schema is missing the “Session” type or the client has not been generated properly
npx prisma generate.Anyone having this issue I would check the generated “PrismaClient” from the node_modules folder (or wherever you put it) has the the “session” property from the Session model.
all of your models should be a property on the client
Of course check this is in your schema
Using Express v5
Hi @olalonde, For context, are you using NestJs? What version of Express / Express Session are you seeing this with? Thanks for posting, -K
Hi, I have the same problem with NestJS, any news?