fix: FK violation publishing self-relation parent & child in one release#26147
Merged
innerdvations merged 2 commits intoMay 12, 2026
Conversation
…violation 1. Concurrent publishes within a content type race on shared join-table state. 2. Errors from scheduled publishes were also silently swallowed leaving no trail in the logs.
|
@garrettheaver is attempting to deploy a commit to the Strapi Team on Vercel. A member of the Team first needs to authorize it. |
innerdvations
approved these changes
Apr 28, 2026
Contributor
|
Internal note: TID 8744 |
Contributor
Author
|
Can I get an update on this please in terms of when it will go into a release? It's an EE feature affecting an EE customer. Thanks! |
Contributor
Hey Garett, it looks like the fix is currently scheduled to release with 5.46.0 according to the milestones |
Contributor
Author
|
Thanks. It had been scheduled for 5.44.1, then it got bumped to 5.45.0, then 5.45.1. Now it's 5.46.0. Given the internal TID / it's on an EE support agreement, can you help prevent it from getting bumped to a later version again? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does it do?
Replaces
Promise.allover a content type's actions inrelease.publishwith sequentialforloops, so within content-type publishes serialize on the shared transaction. Also drops the emptytry/catchwrapping the cron task inscheduling.tsso task failures propagate to Strapi existingjob.on('error')handler instead of being silently swallowed.Why is it needed?
A Content Release in production failed when publishing two documents of the same content type that referenced each other (parent
Pageand childPagevia a self-referential relation, both in one release):The error was only surfaced when a release was triggered manually. Scheduled releases triggered by cron had been hitting the same failure mode (we assume) but the empty
try/catchinscheduling.ts's task callback was swallowing the error, so nothing was being logged.Both publishes shared a transaction via
Promise.all. It is most likely that statements interleaved on the connection, so one branch's delete invalidated the other branch's pre-captured join-table snapshot before the second branch tried to re-insert against it. The deletedpage_id=255is the row the other branch had already removed.User-visible state after the failure: new published rows existed for both documents, but the parent's join rows to all its children were missing, leaving every child orphaned on the published side. The release was recorded as
status='failed'and a 500 error returned.How to test it?
yarn jest packages/core/content-releases. New unit test pins the sequential dispatch.