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 doesn't roll back in NestJS when we pass method from external service #5730
Comments
Thanks @revivalme for the report. We'll have a look at this! |
@revivalme Could you try out williamluke4:patch-1 ? |
Yeah, for some unknown reason it works, but shouldn't. UserModule has exports array with UserService, so whenever I import UserModule into other modules - I already have access to UserService without manually add this service to providers array. (same info here https://docs.nestjs.com/modules#shared-modules) The especially weird part of this is that in both cases, with/without manually add service to providers array, addMoney method of UserService invokes. Also both cases have similar errors: [Just with module import]
[Module import with manual add service to providers]
So, given the above, guess it's too early to close this issue |
@revivalme Both your logs above seem unrelated to this issue. They seem to be a result of you trying to update a record that does not exist in the database
And
|
Hey @revivalme, I'm going to close this issue, if you feel like the problems you are experiencing are still related to this specific issue then feel free to reopen it explaining why. |
Bug description
$transaction works incorrectly in NestJS when we pass method from external service, but works well if it uses method from current service.
It doesn't roll back as expected.
Example:
If write2 will fail - write1 doesn't rollback.
But... rollback will work as expected if write2 refers to the current service method. (this.addMoney)
How to reproduce
https://github.com/revivalme/nestjs-prisma-transaction-test
Bug reproduction section
Expected behavior
Transaction write1 should rollback as transaction write2 failed.
Prisma information
Environment & setup
Conversation from Public Slack here
The text was updated successfully, but these errors were encountered: