-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Cursor pagination of nested relations broken in Prisma 7 #28614
Copy link
Copy link
Closed
Labels
kind/bugA reported bug.A reported bug.
Description
Bug description
It looks like cursor pagination of nested relations is broken in Prisma 7
Severity
Reproduction
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugA reported bug.A reported bug.