interactiveTransactions rollback but don't error out if timeout is reached
See original GitHub issueBug description
When using interactive transactions, the transaction returns successfully even if the timeout was reached and internally the transaction was rolled back.
More context here https://github.com/prisma/prisma/issues/8664#issuecomment-930403241
How to reproduce
- Clone https://github.com/awinograd/prisma-include-clause-bug/tree/interactive-transaction-timeout (note it is a specific branch, not main branch)
- run yarn dev:database
- run prisma migrate dev
- run yarn dev
Expected behavior
Transaction that surpasses timeout should throw an error rather than returning the return value as if nothing has happened.
Prisma information
all included in repro example above
Environment & setup
- OS: MacOS
- Database: PostgresQL
- Node.js version: 16.9.1
Prisma Version
prisma                  : 3.1.1
@prisma/client          : 3.1.1
Current platform        : darwin
Query Engine (Node-API) : libquery-engine c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine        : migration-engine-cli c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine    : introspection-core c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary           : prisma-fmt c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash    : c22652b7e418506fab23052d569b85d3aec4883f
Studio                  : 0.423.0
Preview Features        : interactiveTransactions
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
Transactions and batch queries (Reference) - Prisma
When the application reaches the end of the function, the transaction is committed to the database. If your application encounters an error along...
Read more >spring transaction timeout doesn't work - Stack Overflow
In my understanding, if I set the timeout, such as 10 seconds, Spring will launch a Timer when start a new transaction, if...
Read more >When transaction timeout, rollback didn't work - JBoss.org
Hi, i got some problem with transaction timeout, hope somebody can ... But in case of it could happen again, i would like...
Read more >Prisma 4.7.0 Release - GitClear
If your application encounters an error as the transaction is being executed, the function will throw an exception and automatically rollback ...
Read more >prisma 3.9.0 on Node.js Yarn
New release prisma version 3.9.0 on Node.js Yarn. ... interactiveTransactions rollback but don't error out if timeout is reached ...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

From what I can see on this. The issue is here https://github.com/prisma/prisma/blob/ec0a0182bd81f82b70d1a12a48bd7a523300a5b9/packages/engine-core/src/library/LibraryEngine.ts#L120
The query-engine will never throw an actual error but will return an error object:
We need to check the response and throw an error if we detect it. We need to do the same for rollback
I think this issue is related to another one I opened here: #9584
If the root cause is indeed the same (issue in transaction timeout handling), it should affect regular transactions as well, since in my issue I made an MRE reproducing the error with “regular transactions”.