kleydon / prisma-session-store

Express session store for Prisma
MIT License
116 stars 18 forks source link

session store error #111

Open aresthegofwar opened 1 year ago

aresthegofwar commented 1 year ago

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 commented 1 year ago

@kleydon any idea how to fix this

kleydon commented 1 year ago

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.

rajamoulimallareddy commented 1 year ago

Am using nestjs

rajamoulimallareddy commented 1 year ago

And also passport too

kleydon commented 1 year ago

@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!)

rajamoulimallareddy commented 1 year ago

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

kleydon commented 1 year ago

@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!

ChristopherLMiller commented 1 year ago

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

kleydon commented 1 year ago

@ChristopherLMiller - thanks for the additional data point.

junaidilyas commented 1 year ago

@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.

rajamoulimallareddy commented 1 year ago

@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.

zFlxw commented 6 months ago

I am also encountering this issue. Any fixes yet?

SebaBoler commented 4 months ago

I am also encountering this issue. Any fixes yet?

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