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
hooks do not get CLS transaction #12973
Comments
Also discussed here #8585 |
@papb could you take a look at this? I can raise a PR for this, is this is a miss and there is no real reason to have skipped passing the transaction to the hooks |
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂 |
not stale |
@papb Any updates here? |
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂 |
not stale |
This issue has been automatically marked as stale because it has been open for 14 days without activity. It will be closed if no further activity occurs within the next 14 days. If this is still an issue, just leave a comment or remove the "stale" label. 🙂 |
not stale |
Sorry about the late response, it would be nice if you could make a PR for this @heroic |
@WikiRik Added! |
🎉 This issue has been resolved in version 7.0.0-alpha.15 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Issue Description
If using CLS to set a transaction, then the transaction is not received in the hooks.
What are you doing?
We set a transaction on the HTTP request using CLS. We expect the transaction to be available inside the hooks to be able to use the afterCommit transaction hook. However,
options
does not contain the transaction.Here is the link to the SSCCE for this issue: LINK-HERE
This is inside a Koa2 app.
In the model hook
The output is undefined.
What do you expect to happen?
options.transaction should be the same as the transaction set in the CLS.
What is actually happening?
options.transaction is undefined
Additional context
It appears that this logic is missing inside
save
:sequelize/lib/model.js
Line 2289 in 83be13f
Adding this to
save
fixes this issue.Environment
Issue Template Checklist
How does this problem relate to dialects?
Would you be willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: