-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 hanging indefinitely on create operation to collection with relation back to triggering collection #7352
Comments
I believe #6459 is related (an issue I previously raised) but I hadn't narrowed down the cause of the issue to being relations back to the triggering collection. |
I also suspect this happens on update operations |
@JessChowdhury — please try and reproduce this with the example repo above - at first glance I suspected that this was an infinite loop caused by hook recursion but it does not appear to be so after looking at the code. Not sure what exactly is causing this but it should be relatively easy to spot once you have this pulled up and reproducing reliably. |
@mcornielje090404 does it finish if you pass the i.e. await payload.create({
collection: 'post-audits',
data: { ...strippedDoc, auditType },
overrideAccess: true,
user: req.user,
req,
}) |
@mcornielje090404 yeah, you just need to thread the |
This issue has been automatically locked. |
Link to reproduction
https://github.com/mcornielje090404/payload-3.0-demo/tree/main
Payload Version
3.0.0-beta.67
Node Version
20.13.1
Next.js Version
15.0.0-canary.58
Describe the Bug
When attempting to run a payload "create" operation from within a hook on a collection that has a relation back to the original collection calling the hook the create operation hangs indefinitely.
If I remove the relation back to "posts" on the "posts-audits" collection in that repo the hook will run fine.
Reproduction Steps
Note: I have sometimes noticed the record is created but the promise never resolves.
Adapters and Plugins
db-postgres
The text was updated successfully, but these errors were encountered: