findOrCreate - Transaction cannot be committed because it has been finished with state: rollback #17214
Labels
pending-approval
Bug reports that have not been verified yet, or feature requests that have not been accepted yet
type: bug
Bug Description
Using Model.findOrCreate without passing/using an external transaction or using CLS caused the following error:
Error: Transaction cannot be committed because it has been finished with state: rollback.
Reproducible Example
Using Model.findOrCreate without passing transaction as an option.
What do you expect to happen?
Dont see this error.
What is actually happening?
I saw in your code that you create a transaction in the findOrCreate method and commit it at https://github.com/sequelize/sequelize/blob/v6.32.1/src/model.js#L2461
but could not find where you rollback that transaction and whether this could be the culprit.
Environment
Would you be willing to resolve this issue by submitting a Pull Request?
No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: