Promise.all
in interactive $transaction
unexpectedly merges operations
#23951
Labels
bug/2-confirmed
Bug has been reproduced and confirmed.
kind/bug
A reported bug.
team/client
Issue for team Client.
topic: batching
topic: interactiveTransactions
topic: Promise.all
topic: $transaction
Related to .$transaction(...) Client API
Discussed in #23845
Originally posted by @ArthurMelin April 10, 2024
Bug description
We found some weird behavior when using Promise.all inside interactive transactions.
The two queries inside the Promise.all get merged together.
How to reproduce
Inside an interactive $transaction, make two findUnique queries, each for a different unique field, batched together with a Promise.all (to hopefully reduce impact of network latency).
Expected behavior
Two queries should be made. The result of Promise.all should contain the result of each one.
Instead, only one query is made with a merge of the where conditions of both operations. The result of Promise.all contains the result of the query and a null.
Prisma information
Debug logs
Environment & setup
PostgreSQL 16.0 (Debian 16.0-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
(docker)Prisma Version
The text was updated successfully, but these errors were encountered: