#1812·lucia

Prisma MongoDB adapter: Argument expiresAt is missing when creating session

Author: kerstinSimoneMCreated Jul 3, 2025Updated Mar 15, 2026

Issue:

When using Lucia v2 ([email protected]) with @lucia-auth/[email protected] and Prisma 5.x on MongoDB, session creation fails with:

Argument `expiresAt` is missing.

My Prisma schema:

model Session {
  id        String   @id @map("_id")
  userId    String
  expiresAt DateTime @map("expires")
  user      User     @relation("UserSessions", fields: [userId], references: [id])
  @@map("sessions")
}

The error occurs when Lucia tries to create a session. The session object passed to Prisma does not have expiresAt set, and patching the adapter to rename expires to expiresAt does not help, as the property is missing entirely.

What I tried:

  • Cleared all sessions from the DB
  • Regenerated Prisma client and pushed schema
  • Patched the adapter to rename expires to expiresAt
  • Confirmed only one version of the adapter is installed
  • Confirmed Prisma expects expiresAt in TypeScript

Expected behavior: Lucia should create a session with the correct expiry field for Prisma MongoDB.

Versions:

  • lucia: 2.1.1
  • @lucia-auth/adapter-prisma: 3.0.2
  • @prisma/client: 5.22.0
  • MongoDB

Additional context: This seems to be a mapping issue between what Lucia provides and what Prisma expects for MongoDB. Please advise if there’s a workaround or if this is a bug in the adapter.