Skip to content
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

findOrCreate - Transaction cannot be committed because it has been finished with state: rollback #17214

Open
zotakk4o opened this issue Mar 27, 2024 · 2 comments
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug

Comments

@zotakk4o
Copy link

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

  • Sequelize version: sequelize@6.32.1
  • Node.js version: 20.11.0
  • If TypeScript related: TypeScript version:
  • Database & Version: mysql8
  • Connector library & Version:

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.

@zotakk4o zotakk4o added pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug labels Mar 27, 2024
@KrishnaSuravarapu
Copy link

We too are facing this issue. Any updates on this ?

@zotakk4o
Copy link
Author

zotakk4o commented May 7, 2024

Any comments? Should I provide more information?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug
Projects
None yet
Development

No branches or pull requests

2 participants