Skip to content

Cursor pagination of nested relations broken in Prisma 7 #28614

Closed

Description

@hayes

Bug description

It looks like cursor pagination of nested relations is broken in Prisma 7

https://github.com/hayes/pothos/blob/9eb015757e6134c2f6426881f57ef49c71223c7a/packages/plugin-prisma/PRISMA_BUG_REPRODUCTION.md

Severity

⚠️ Major: Breaks core functionality (e.g., migrations fail)

Reproduction

https://github.com/hayes/pothos/blob/9eb015757e6134c2f6426881f57ef49c71223c7a/packages/plugin-prisma/PRISMA_BUG_REPRODUCTION.md

Expected vs. Actual Behavior

Querying for the same data with the same filters directly or in a nested selection yields different results (nested result returns an empty set)

Frequency

Consistently reproducible

Does this occur in development or production?

Both development and production

Is this a regression?

This definitely worked in the rust engine, but I am not sure if this ever worked correctly with adapters

Workaround

Querying data without bested selections works, but for Pothos this would be massively inefficient and require a lot of refactoring

Prisma Schema & Queries

model Post {
  id        Int         @id @default(autoincrement())
  bigIntId  BigInt      @unique
  createdAt DateTime    @unique @default(now())
  updatedAt DateTime    @updatedAt
  title     String
  content   String?
  author    User        @relation(fields: [authorId], references: [id])
  authorId  Int
}

model User {
  id        Int       @id @default(autoincrement())
  email     String    @unique
  name      String?
  posts     Post[]
}
const prisma = new PrismaClient({
  adapter: new PrismaBetterSqlite3({ url: 'file:./dev.db' })
});

// ✓ WORKS
await prisma.post.findMany({
  where: { authorId: 1 },
  take: 2,
  skip: 1,
  cursor: { id: 245 },
  orderBy: { createdAt: 'desc' }
});

// ✗ FAILS (returns 0 posts instead of 2)
await prisma.user.findUnique({
  where: { id: 1 },
  include: {
    posts: {
      take: 2,
      skip: 1,
      cursor: { id: 245 },
      orderBy: { createdAt: 'desc' }
    }
  }
});

Prisma Config

// Add your `prisma.config.ts`

Logs & Debug Info

// Debug logs here

Environment & Setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

7.0.0

Activity

  1. added
    kind/bug
    on Nov 21, 2025
  2. hayes commented on Nov 21, 2025

    @hayes
    ContributorAuthor

    I am on vacation without a computer, but have been pinged several times about Prisma 7 and Pothos issues. I've done my best to create a clear reproduction via llms I can use from my phone. Apologies for not having a more complete report, but hopefully this is clear enough to show the issue

  3. hayes commented on Dec 3, 2025

    @hayes
    ContributorAuthor

    had some time to actually dig into this a bit more. I think the root cause here is related to the new adapters default DateTime representation being different than what was used in prisma 6. Explicitly setting the format in the adapter resolves the issue

  4. TrevHeath commented on Feb 17, 2026

    @TrevHeath

    @hayes I am running into this issue, can you expand on your fix here?

  5. arasrezaei commented on Feb 19, 2026

    @arasrezaei

    still broken (v7.4.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions