-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: client handling of batched queries when some fail, and some not #16574
Conversation
251a02a
to
4ef83c8
Compare
packages/client/tests/functional/find-unique-or-throw-batching/tests.ts
Outdated
Show resolved
Hide resolved
packages/client/tests/functional/find-unique-or-throw-batching/tests.ts
Outdated
Show resolved
Hide resolved
The regression affected binary and library engines. For data proxy, there's a different problem that manifests when executing the same test (The test exercises two different problems) The problem in particular (after debugging the data proxy) is that the engine adapter is not able to discern errors coming from individual queries in a batch, and as a consequence, doesn't reject a promise that errored. If we do this: const found = prisma.user.findUniqueOrThrow({ where: { id } })
const notFound = prisma.user.findUniqueOrThrow({ where: { id: missing } })
const result = await Promise.allSettled([found, notFound]) We get: [
{ status: 'fulfilled', value: { id: id } },
{ reason: new NotFoundError('No User found'), status: 'rejected' },
] while with the data proxy, we get. [
{ status: 'fulfilled', value: { id: 'xqwhv5rgkt2' } },
{ status: 'fulfilled', value: undefined }
] I leave to @aqrln the investigation, ticket creation, and (if doable directly) addressing of the problem described here. To reproduce it, it is enough to unskip the test provided in this patch. |
…16574) * Fix some error management in engine code * Bump versions * Added regression test * Allow for data proxy tests to run * Run in every provider * Temporary skip data proxy * Make tests resilient to mongo id format * Try to unskip the test * Reproduce & fix batch query issue for data proxy Co-authored-by: Sergey Tatarintsev <tatarintsev@prisma.io>
…16574) * Fix some error management in engine code * Bump versions * Added regression test * Allow for data proxy tests to run * Run in every provider * Temporary skip data proxy * Make tests resilient to mongo id format * Try to unskip the test * Reproduce & fix batch query issue for data proxy Co-authored-by: Sergey Tatarintsev <tatarintsev@prisma.io>
…16574) * Fix some error management in engine code * Bump versions * Added regression test * Allow for data proxy tests to run * Run in every provider * Temporary skip data proxy * Make tests resilient to mongo id format * Try to unskip the test * Reproduce & fix batch query issue for data proxy Co-authored-by: Sergey Tatarintsev <tatarintsev@prisma.io>
Addresses prisma/prisma-engines#3458 (comment)
Depends on merging and updating engine hashes for prisma/prisma-engines#3458 as I need to write some unit tests to prevent regressions.
Before the release of native findXOrThrow, there were no instances of batching where commonly some promises failed while others succeeded. And the code handling that scenario was broken. This PR attempts to fix it.