Closed Dannyftm closed 1 year ago
Hi @Dannyftm, thanks for this. Does your prisma.schema file have a session model defined?
model Session {
id String @id
sid String @unique
data String
expiresAt DateTime
}
If you can post the "set-up" code you are using, hopefully someone can take a look, or will have an idea what's going on.
I do have that, I added that before adding the package into my project.
model sessions {
id String @id @db.VarChar(255)
sid String @unique @db.VarChar(255)
data String @db.Text
expiresAt DateTime @map("expires_at")
}
This is how I have mine set up. Also I should add I'm using MySQL for my database.
Ah, got it. The name of the table has to be Session
Me changing it to sessions is what broke it because it couldn't find the table sessions
that I had set it to.
Glad to hear things are working!
I have the same issue, but my data model is correctly set up.
This is my data model
And I verified the table exists in the production database. Any thoughts on what might be causing this?
Hi @madooei - thanks for the report. No, I don't currently know what could be causing this.
One thought: Could it be that the findUnique()
function is being called at a time when the prisma client is not created, or not fully
created? (The fact that the call is being interpreted as <undefined>.findUnique()
might suggest this...)
Thanks for the prompt reply @kleydon!
One thought: Could it be that the [..] the prisma client is not created, or not fully created?
I thought that might be the case, so I added npx prisma generate
to the deployment pipeline. It runs it before running the Express app. That should create the client (I don't know about "fully created").
It's a strange situation!
I don't know about "fully created"
(Here I was just thinking about "race conditions" - say one process is building/rebuilding the prisma client, while another, process is making a request that depends on the prisma client existing... Just a thought.)
Hello,
When I first installed the package and ran my project I got the following error when it tried to start.
Looking into the code it looks like this is for the
return [4 /*yield*/, this.prisma[this.sessionModelName].findUnique()
call.I already had the latest version of prisma and express-session installed so I didn't install them when I installed prisma-session-store.