auditt800
PPrisma
•Created by auditt800 on 9/16/2024 in #help-and-questions
Prisma Interactive transactions not waiting on await statement
Prisma version: 5.19.1
Database Engine: Postgres
I am running the following code structure inside an interactive transaction
I noticed that the code inside $transaction is not waiting for writeToStuff1(txn) to complete, even though await keyword is used.
The code execution is moving to writeToStuff3WDependentOnStuff1, before row is add to database for Stuff 1 (writeToStuff1).
This is causing error and rollbacks as writing to stuff3 requires writing to stuff1 is complete and a row exists.
When I ran the code without $transaction block, its respecting the await keyword again, and waiting for writeToStuff1() to finish before moving to writeToStuff3WDependentOnStuff1()
Could someone confirm if await keyword, Prisma Interactive transactions, doesn't guarantee wait until completion of statement?
If yes, any suggestions to achieve the above using $transaction but guaranteeing statement order?
Thanks
2 replies