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
“Transaction API error: Transaction not found” #16050
Comments
One nice aspect to exclude here would be PlanetScale databases and |
Found what caused it. } catch (err) {
console.error(err)
res.status(500).send(err.toString())
} finally {
await prisma.$disconnect()
} |
We should try to figure out what is going on here. |
Hey @aqrln, I noticed you signed on yesterday... revisiting this repo today as well. Seems like there are a few bugs related to Replicache, I’ll see if I can work them out first and will let you know once I have. |
Hey @heymartinadams no worries, I already finished the investigation and was going to share an update with you tomorrow. The gist is the issue was triggered by calling I assume you actually meant to put the |
Hi @aqrln, I didn’t know what I was doing regarding the So I finally figured out how to make it work, yay! 🎉 Looking forward to implementing it, and, once implemented, would love to connect with someone at Prisma to write up a blog post about it! Offline / undo-redo / and instant UI are definitely features in high demand and I think a blog post could add tremendous value to many devs. Please let me know! CleanShot.2022-11-18.at.09.52.44.mp4 |
Make the error messages for closed transactions more detailed, add extra context about the transaction timeout. Before: - `Transaction API error: Transaction already closed: A query/commit/rollback cannot be executed on a closed transaction..` (also note the double "." at the end) Now: - `Transaction API error: Transaction already closed: A query/commit/rollback cannot be executed on a committed transaction.` - `Transaction API error: Transaction already closed: A query/commit/rollback cannot be executed on a transaction that was rolled back.` - `Transaction API error: Transaction already closed: A query/commit/rollback cannot be executed on an expired transaction. The timeout for this transaction was X ms, however Y ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction.` Additionally, the "Transaction not found error" is now also more verbose, ref: https://www.notion.so/disconnect-with-iTX-f3cfee3ff4924e40aa90aadb2454e9fa?d=3bd7c7103b02461bbfe414a978a994c1#547ab127682b41898c87bdd5c841c0bf Also contains minor cleanup things related to iTX: * Remove the unused `CachedTx::Aborted` variant * Remove references to an obsolete env var that doesn't exist since #3028 from comments and `.envrc` Client PR: prisma/prisma#16382 Closes: prisma/prisma#13713 Ref: prisma/prisma#16050 Ref: #3028
Hi @heymartinadams and sorry for the late reply!
Thank you, I passed your message to the team!
Yep, I didn't look into what happens inside the transaction itself in details, so I can't give much additional advice, but in the context of this issue just removing the $disconnect should be good! You can leave the try/catch block if you need it for any other reason, no need to remove it like in onetask-me/prisma-replicache-demo@734f9ed, just remove the In prisma/prisma-engines#3391 I changed the error message from just |
I'm going to go ahead and close this issue since it has been resolved. Feel free to leave a comment or open a new issue if you think there is still something missing on our side. We also have ideas for improvements of |
Thank you @aqrln ✨ A more detailed error message might have been helpful at the time. Glad it’s made its way into I’ll write up a blog post about Replicache shortly. https://github.com/simplerlist/replicache-demo |
Hello @aqrln Is any fix found for this ? I am facing same issue |
This issue is closed, so we do not think there is a problem any more. If something is not working for you @aruns05, please open a new issue. Thanks. |
Bug description
Context: I’m trying to implement Replicache using Prisma interactive transactions for an offline-first, instant UI. 🚀
Bug: While using transactions, I get a
Transaction API error: Transaction not found
error.How to reproduce
.env
fileyarn
(ornpm install
)yarn db:reset
yarn dev
Expected behavior
All transactions should be found.
Prisma information
Schema: https://github.com/ConsciousApps/replicache-demo/blob/main/prisma/schema.prisma
Prisma Transactions:
https://github.com/ConsciousApps/replicache-demo/blob/main/pages/api/replicache/push.js#L24-L59
https://github.com/ConsciousApps/replicache-demo/blob/main/pages/api/replicache/pull.js#L20-L61
(bug shows up in either files)
Environment & setup
16.16.0
Prisma Version
The text was updated successfully, but these errors were encountered: