New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't compact findUniqueOrThrow #3458
Conversation
Tried the following reproduction, from issue 16549, against this branch's binary engine: Schema
index.ts import { PrismaClient } from '.prisma/client';
const prisma = new PrismaClient({
log: ["info", "error", "query", "warn"],
__internal: {
engine: {
endpoint: "http://127.0.0.1:57581",
},
},
} as any);
const id1 = 'VALID_ID1';
const id2 = 'VALID_ID2';
async function setup(): Promise<void> {
// 1. Clear DB
console.log('DeleteMany:', await prisma.post.deleteMany());
// 2. Add posts
console.log('\nCreate posts:', await prisma.post.createMany({
data: [
{
id: id1,
title: 'New post',
},
{
id: id2,
title: 'New post 2!',
}
],
}));
}
async function find(id: string): Promise<void> {
// 1. Query it with findUnique (no error)
console.log('\nFindUnique:', await prisma.post.findUnique({
where: { id },
}));
// 2. Query it with findUniqueOrThrow (crash??)
console.log('\nFindUniqueOrThrow:', await prisma.post.findUniqueOrThrow({
where: { id },
}));
}
async function main(): Promise<void> {
await setup();
await Promise.all([id1, id2].map(find));
}
main().then(() => console.log('OK!')).catch((err) => console.error(err)); Output: OK! However, if I issue another request to findUniqueOrThow with an invalid ID:
I get:
I think this might be a different problem. Will need to investigate tomorrow. |
This can be merged as-is. The problem subject of my previous comment
Is a different one and will be addressed by prisma/prisma#16574 |
I am seeing the following issue with batching:
example based on Query optimization page |
Overview
fixes prisma/prisma#16548