Skip to content

fix(hosting): drop CloudFront invalidation from BlocksConfigDeployment (aws-cdk#15891 CREATE timeout) - #473

Closed
Simone319 wants to merge 1 commit into
mainfrom
fix/hosting-cloudfront-invalidation-timeout
Closed

Simone319 wants to merge 1 commit into
mainfrom
fix/hosting-cloudfront-invalidation-timeout

Conversation

@Simone319

Copy link
Copy Markdown
Contributor

Problem

All three of #391, #460 and #459 are failing on the same shared E2E Hosting jobs, and it is not their code — it is a latent bug in packages/core/src/hosting.ts.

The Hosting/BlocksConfigDeployment BucketDeployment was given a CloudFront distribution: + distributionPaths:. A BucketDeployment that is asked to invalidate waits for the invalidation to be CONFIRMED, and that confirmation step hangs on a fresh stack CREATE — aws-cdk#15891. The result is a cascade:

CREATE_FAILED → ~30-minute rollback → retry → the 63-minute job timeout trips → all E2E Hosting jobs cancelled.

The code is latent from #115 / 9d4ccea8; it only started firing after #465/#466 made CI perform fresh stack CREATEs rather than updates, which is why three unrelated PRs suddenly went red together.

Fix

Remove distribution and distributionPaths from only the BlocksConfigDeployment BucketDeployment. Nothing else changes: sources, destinationBucket, destinationKeyPrefix, prune, cacheControl and the addDependency ordering over the asset deployments are all untouched.

The invalidation was defense-in-depth only, so dropping it is safe:

  • the deployed config.json already carries Cache-Control: public, max-age=60, must-revalidate, so any edge entry self-expires within 60s;
  • the primary staleness guard is the step-5a no-cache placeholder registration, which is unchanged.

Cache impact is therefore negligible — a worst-case 60-second window that already existed by design.

This also matches existing repo precedent: the asset deployments in packages/hosting/src/constructs/hosting_construct.ts deliberately carry no distribution/distributionPaths, and hosting_construct.atomic_deploy.test.ts already asserts that no BucketDeployment emits an invalidation.

Tests

The one test that asserted the removed wiring — invalidates the post-rewrite cache key (/builds/<id>/.blocks-sandbox/*) — has been inverted into a regression guard, does NOT emit a CloudFront invalidation on any BucketDeployment, mirroring the atomic_deploy precedent. It scans every Custom::CDKBucketDeployment in the synthesized template and fails if any renders DistributionId/DistributionPaths, plus a vacuity guard so it cannot pass by finding zero deployments.

Verified locally (Node 22, per .nvmrc):

  • npm run build (root) → exit 0
  • npm test -w @aws-blocks/core → 729 pass / 0 fail
  • npm test -w @aws-blocks/hosting → 845 pass / 0 fail
  • changeset-guard.ts validate-structure / verify-coverage / block-major / verify-umbrella → all exit 0
  • Negative control: re-adding distribution/distributionPaths makes the new test fail (exit 1), proving the guard is real and not vacuous.

The changeset bumps both @aws-blocks/core and the @aws-blocks/blocks umbrella, as verify-umbrella requires (#273).

Fixes the shared E2E Hosting failure blocking #391, #460 and #459.

@Simone319
Simone319 requested a review from a team as a code owner September 1, 2026 20:42
@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a211111

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@aws-blocks/core Patch
@aws-blocks/blocks Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Simone319
Simone319 marked this pull request as draft September 1, 2026 21:14
@Simone319 Simone319 closed this Sep 2, 2026

This branch was previously deployed

1 inactive deployment
publish — a2111113 Deployed Sep 1, 2026 by Simone319 via bench / summary #1214
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant