fix(infra): stop deploys from wiping Lambda-generated data (prune: false) - #5
Merged
Conversation
…lse) BucketDeployment defaults to prune: true, which deletes every object in the site bucket that isn't in the source (site/dist). site/dist contains no data/ prefix, so EVERY `cdk deploy` deleted the entire data/ prefix — all Lambda output (release-radar.json, hn-digest.json, gh-trending.json) and every archive under data/archive/. This is the master root cause of the stale site: even after the Lambdas successfully wrote fresh data, the next deploy wiped it, and the static build fell back to the committed seed files. Confirmed live: immediately after a deploy, `aws s3 ls data/` returned 0 objects. Set prune: false so deploys only add/overwrite the built site files and leave the Lambda-managed data/ prefix intact. Site assets are still updated normally; only the destructive delete-sweep is disabled.
Uh oh!
There was an error while loading. Please reload this page.
datj9 added a commit
that referenced
this pull request
Jul 11, 2026
BucketDeployment defaults to prune: true, which deletes every object in the site bucket that isn't in the source (site/dist). site/dist contains no data/ prefix, so EVERY `cdk deploy` deleted the entire data/ prefix — all Lambda output (release-radar.json, hn-digest.json, gh-trending.json) and every archive under data/archive/. This is the master root cause of the stale site: even after the Lambdas successfully wrote fresh data, the next deploy wiped it, and the static build fell back to the committed seed files. Confirmed live: immediately after a deploy, `aws s3 ls data/` returned 0 objects. Set prune: false so deploys only add/overwrite the built site files and leave the Lambda-managed data/ prefix intact. Site assets are still updated normally; only the destructive delete-sweep is disabled. Co-authored-by: Dat <dat.nguyen@ringkas.co.id>
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 freeto 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.
The master root cause of the stale site
`BucketDeployment` defaults to `prune: true` — it deletes every object in the destination bucket that isn't in the source (`site/dist`). `site/dist` has no `data/` prefix, so every `cdk deploy` deleted the entire `data/` prefix: all Lambda output (`release-radar.json`, `hn-digest.json`, `gh-trending.json`) and every archive under `data/archive/`.
This is why the site stayed stale even after fixing the scrape (#1), the schema (#2), the S3 key (#3), and the timeout (#4): the Lambdas wrote fresh data, then the very next deploy wiped it, and the static build fell back to the committed seed files.
Confirmed live: immediately after the PR #4 deploy + final rebuild, `aws s3 ls s3:///data/` returned 0 objects — fresh data and all archives gone — while the site HTML was intact.
The destructive cycle:
Change
Set `prune: false` on the `DeploySite` BucketDeployment. Deploys now only add/overwrite the built site files and leave the Lambda-managed `data/` prefix intact. Site assets still update normally; only the destructive delete-sweep is disabled.
Test plan
Note: archives written before this fix were already pruned and can't be recovered, but new ones will accumulate correctly from here.