prisma-session-store icon indicating copy to clipboard operation
prisma-session-store copied to clipboard

session store error

Open aresthegofwar opened this issue 2 years ago • 13 comments
trafficstars

Argument of type 'PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation>' is not assignable to parameter of type 'IPrisma<"session">'. Property 'session' is missing in type 'PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation>' but required in type 'Record<"session", { create(args: ICreateArgs): Promise<IPrismaSession>; delete(args: IDeleteArgs): Promise<IPrismaSession>; deleteMany(args?: unknown): Promise<...>; findMany(args?: IFindManyArgs): Promise<...>; findUnique(args: IFindUniqueArgs): Promise<...>; update(args: IUpdateArgs): Promise<...>; }>'.ts(2345)

aresthegofwar avatar Mar 20 '23 08:03 aresthegofwar

@kleydon any idea how to fix this

aresthegofwar avatar Mar 20 '23 08:03 aresthegofwar

Hi @aresthegofwar, thanks for this.

I haven't encountered the error before, but if you post some context (ideally a PR on a fork of this repository, but possibly just a code snippet, showing how the error can be reproduced) it'll make it easier for anyone using this package to help with ideas for a solution.

By any chance are you using Nest or Passport? In the past, I believe other users have reported type mis-matches with these libraries; I'm not 100% sure if these have been solved yet or not.

kleydon avatar Mar 20 '23 15:03 kleydon

Am using nestjs

rajamoulimallareddy avatar Mar 20 '23 15:03 rajamoulimallareddy

And also passport too

rajamoulimallareddy avatar Mar 20 '23 15:03 rajamoulimallareddy

@rajamoulimallareddy Just to clarify: You are using nest and passport with prisma-session-store and seeing this issue? Or you are using nest and passport with prisma-session-store successfully, and not seeing this issue?

(I've not used nest or passport, so related expertise is definitely appreciated here!)

kleydon avatar Mar 20 '23 16:03 kleydon

Using nest and passport with prisma-session-store and am getting seeing this issue. And also even if it runs successfully the cookies are not generated for some reason

rajamoulimallareddy avatar Mar 20 '23 16:03 rajamoulimallareddy

@rajamoulimallareddy Good to know; thanks for posting this context.

My time's pretty limited to work on this at the moment, but hopefully others who are using this library can jump in? Happy to review any PRs that can sort this out!

kleydon avatar Mar 20 '23 16:03 kleydon

i'm using nestjs and prisma as well and seeing this issue, no passport. Nest is v9.3.9 and prisma v4.10 prisma-session-store is v3.1.10

ChristopherLMiller avatar Mar 21 '23 08:03 ChristopherLMiller

@ChristopherLMiller - thanks for the additional data point.

kleydon avatar Mar 21 '23 15:03 kleydon

@aresthegofwar looks like you haven't generated the client types or missing the session model. Try defining the Session model in your schema.prisma if you haven't already:

model Session {
  id        String   @id @default(auto()) @map("_id") @db.ObjectId
  sid       String   @unique
  data      String
  expiresAt DateTime
}

And then run npx prisma generate.

junaidilyas avatar Apr 01 '23 21:04 junaidilyas

@aresthegofwar looks like you haven't generated the client types or missing the session model. Try defining the Session model in your schema.prisma if you haven't already:

model Session {
  id        String   @id @default(auto()) @map("_id") @db.ObjectId
  sid       String   @unique
  data      String
  expiresAt DateTime
}

And then run npx prisma generate.

Am not using mongoose and also I did generate the schema. It works fine when i login through login page.

rajamoulimallareddy avatar Apr 01 '23 22:04 rajamoulimallareddy

I am also encountering this issue. Any fixes yet?

zFlxw avatar Nov 15 '23 19:11 zFlxw

I am also encountering this issue. Any fixes yet?

just run npx prisma generate after when you have added model Session

SebaBoler avatar Jan 01 '24 21:01 SebaBoler