lucia-auth / lucia

Authentication, simple and clean
https://lucia-auth.com
MIT License
8.96k stars 460 forks source link

[Bug]: createSession is sending malformed database fields to DB #1372

Closed singhofmarco closed 7 months ago

singhofmarco commented 7 months ago

Package

lucia

Describe the bug

I'm using prisma 3.0.1 and prisma-adapter 4.0.0, createSession throws a Prisma exception. It seems like it's ignoring the db fields and tries to send camelCased fields to prisma instead:

PrismaClientValidationError: 
Invalid `prisma.session.create()` invocation:

{
  data: {
    id: "znhqg0v3dmu6qjm6p5f51uv6s6tpvimovujx5ftw",
    userId: "samytgqj90l306j",
    expiresAt: new Date("2024-02-27T10:49:22.394Z"),
+   expires_at: DateTime
  }
}
pilcrowOnPaper commented 7 months ago

No this is expected. The Prisma adapter uses camel case instead of snake cases with v3 to be consistent with Prisma.

https://lucia-auth.com/upgrade-v3/prisma/

singhofmarco commented 7 months ago

I see, I had forgotten to update my schema... Thanks!