Closed SmilingJoe closed 1 year ago
As a temporary workaround, if I downgrade and pin passport
to version 0.5.3 the problem does not occur.
Going with this solution for the time being.
@SmilingJoe Thanks for logging this, and sorry nobody responded yet.
Curious: Are you sure that an exception was occurring, causing a crash or an actual problem? Is it possible that a warning log message is being output, but that no crash was actually occurring?
I think (based on the thread in issue #91, as you referenced) that the issue may now be fixed - but I'm not 100% certain.
(After investigating, appears that this may be related to Issue #91)
Working on integrating the PrismaSessionStore into a NestJS/Prisma project.
Running into a problem where an exception is being thrown after the first session is stored to the MySQL database, where no session was previously recorded.
With passing
prismaService
as the PrismaClient argument into PrismaSessionStore() the code compiles and runs. However when I attempt to execute the login route I see that a newsession
record has been created in the DB, but the server throws the following exception:Initially I thought it might be a case-sensitivity issue, but after setting the
session
table to lowercase and still seeing the error, I ruled that out.This appears to happen only during the first login attempt, when the session table is empty. Upon submitting the login request a second time in Postman, the request succeeds without an exception and the user data is returned.
I modified the
node_modules/@quix03/prisma-session-store/dist/lib/prisma-session-store.js
file to include console.log lines at the beginning of the_this.destroy()
method, and for thecase 4
option.On first pass through the login route, I get this output:
If I attempt to execute the login route again with the same credentials in Postman, I don't get the exception and the user details are returned as expected.
Not sure why it's attempting to delete the first session record it just created? Confused as to why the exception only occurs when the
session
table is completely empty. Obviously I'm missing something here.Any help would be greatly appreciated.
Packages
References:
NestJS: https://docs.nestjs.com/recipes/prisma#use-prisma-client-in-your-nestjs-services Prisma: https://www.prisma.io/nestjs (About halfway down the page)
prisma.service.ts
main.ts
My prisma.schema file
Migration completed successfully, table exists in DB