From 3586ba850b33c8c9932524c525c0b63a4619a89b Mon Sep 17 00:00:00 2001 From: Dat Date: Sun, 7 Jun 2026 17:24:44 +0700 Subject: [PATCH] fix(infra): stop deploys from wiping Lambda-generated data (prune: false) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- infra/lib/tech-bytes-stack.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/infra/lib/tech-bytes-stack.ts b/infra/lib/tech-bytes-stack.ts index a41a143..630cfe9 100644 --- a/infra/lib/tech-bytes-stack.ts +++ b/infra/lib/tech-bytes-stack.ts @@ -259,6 +259,13 @@ function handler(event) { destinationBucket: siteBucket, distribution, distributionPaths: ['/*'], + // prune defaults to true, which deletes every object in the bucket not + // present in site/dist — including the entire data/ prefix that the + // Lambdas write (release-radar.json, hn-digest.json, gh-trending.json and + // their archives). That made every deploy wipe all generated content. + // Disable pruning so deploys only add/overwrite the built site and leave + // the Lambda-managed data/ prefix intact. + prune: false, }); // ---------------------------------------------------------------