Repository navigation
Purge the web cache after the write commits, not inside it - #276
Merged
Merged
Conversation
Payload runs afterChange, afterDelete and afterOperation hooks inside the write transaction, so a purge sent from one reached apps/web while the write was still invisible to every other connection. Next re-rendered against the pre-write database and cached that: a 404 for a page being published, the old content for an edit. The Kubernetes whitepaper published on 2026-09-22 stayed a 404 for its whole ISR window this way, and its listing kept the old cards until someone purged by hand. revalidateWebAfterCommit schedules the purge past the commit and does not make the save wait for it. With no transaction open it behaves exactly as before, so the cache-purge endpoint and one-shot scripts are unchanged.
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.
Publishing the Kubernetes whitepaper left its page a 404 for the full ISR window and kept the new card off
/resource-center. Purging the same paths by hand a few minutes later worked in 15 seconds.Root cause
Payload runs afterChange, afterDelete and even afterOperation hooks inside the write transaction;
commitTransactionis the last thing the operation does. The purge therefore reachedapps/webwhile the write was still invisible to every other connection, so Next re-rendered against the pre-write database and Vercel cached that result: a 404 for a page being published, the old content for an edit.This affects every publish, not just this one.
Checked and refuted first
resourcesto/resource-center) was already correct and deployed.WEB_REVALIDATE_SUPPRESSis unset on the droplet.webhooks-publishandindexnow-publishswallow their own errors.The fix
revalidateWebAfterCommitschedules the purge past the commit and does not make the save wait for it, because a hook must not block a save on cache invalidation. Hooks passreq.transactionID; with no transaction open the helper behaves exactly likerevalidateWeb, so the cache-purge endpoint and one-shot scripts are unchanged.Incident written up in
docs/operations/INCIDENTS.md.Verifying after deploy
Publish or edit any document and watch its listing without purging by hand. The page should turn over within a few seconds.
checks: cms lint, typecheck, build, 2037 tests