Prisma Client Extensions and Interactive Transactions #20016
Replies: 3 comments 11 replies
|
Hello @babasbot 👋 There's a GitHub Issue which seems to be related to the issue you are facing: But, the GitHub issue mentions that this is fixed in the latest prisma version. I can see that you are using |
|
I'm having the same problem for transaction with extensions, the only solution for now is adding a parameter to the function where you pass the current transaction variable so you can use the current
It would be good to support transactions also in extensions in a simpler way. |
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that haven’t had any recent activity and appear to be outdated. If this discussion is still important to you or unresolved, we’d love to hear from you! Feel free to reopen it or start a new one with updated details. For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and being part of the community! |
Uh oh!
There was an error while loading. Please reload this page.
I am attempting to generate an audit log using Prisma Client Extensions by intercepting all model operations as defined in the provided script.
The extension works as expected, except for interactive transactions. Suppose you got the following interactive transaction:
The previous code will fail and throw the following exception:
{ "code": "P2028", "clientVersion": "4.16.1", "meta": { "error": "Transaction already closed: A query cannot be executed on an expired transaction. The timeout for this transaction was 5000 ms, however 5029 ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction." } }It appears that the Prisma client extension is attempting to insert audit log records using the base client (
prisma) rather than the transaction clienttx.Can someone advise me on how to bind the Prisma client to the transaction instance?
I created the following repository to reproduce the error: https://github.com/babasbot/prisma-auditlog-extension-bug
Thanks! 🖖
All reactions