Skip to content

docs(hosting,pipeline): props and errors tables, front doors first, custom door guide in its own file - #1636

Merged
xyos merged 12 commits into
aws:mainfrom
xyos:docs/readme-hosting-pipeline
Nov 20, 2026
Merged

xyos merged 12 commits into
aws:mainfrom
xyos:docs/readme-hosting-pipeline

Conversation

@xyos

@xyos xyos commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • packages/hosting/README.md was 1,669 lines (12,969 words). ## Secrets & config, more than 200 lines, came before the choice of front door, and about 235 lines for authors of a custom door sat inside ## Front doors.
  • It had no quick start, no list of HostingConstructProps and no list of errors. Many sentences said "fails synth" or "throws" without the error name.
  • Some statements were wrong. The paragraph on Next.js behind the alb and stacked doors called it "the exception" and told the reader to "serve it there through CloudFront"; synth fails there. The custom-door wiring check was said to fail "with ServeStaticAsset", which is a rule name in the message of UnsupportedFrontDoorError. The stacked custom-door example sent the origin secret over plain HTTP.
  • The allowPlainHttp rule and the streaming/buffered rule were each restated in several sections.
  • packages/pipeline/README.md (124 lines) documented none of its props and said of Pipeline.create() only that async stage factories need it.

Issue #, if available:

Changes

This pull request has four commits. The first, 74bea9719, moves "Bring your own front door" verbatim into packages/hosting/CUSTOM-FRONT-DOOR.md and adds that file to files in packages/hosting/package.json. The README keeps the heading, a summary, a link from the front-door table, and what AWS Blocks checks and enforces for such a door. The other three commits are on top of it.

packages/hosting/README.md

Corrections:

  • Next.js behind alb and stacked fails synth with StreamingServerNeedsStreamingDoorError; behind the HTTP API the adapter builds it buffered (packages/hosting/src/constructs/hosting_construct.ts:3002-3015, packages/hosting/src/adapters/shared/build_profile.ts:5-11).
  • getSecret throws no secret reference found; the README gave only the getConfig message (packages/hosting/src/secret-runtime.ts:141).
  • HostingConstruct is exported from @aws-blocks/hosting/constructs (packages/hosting/src/constructs/index.ts:18), not @aws-blocks/hosting.
  • The codec example imports the five names it uses (packages/hosting/src/index.ts:19-48); it imported four it did not use and omitted config, secret and isSecret.
  • An unknown door and an unknown door option have one row each, with UnsupportedFrontDoorError and InvalidFrontDoorOptionError (packages/hosting/src/constructs/front_door_options.ts:620,651,669).

Added, derived from the source:

  • ## Quick start: a runnable adapter call, the adapter table (src/adapters/{nextjs,nitro,astro,sveltekit,spa}.ts), the entry-point table (package.json exports) and the HostingConstructProps table (src/constructs/hosting_construct.ts:170-607).
  • ## Errors: 29 HostingError names, each condition taken from its throw site in src/constructs/*.ts and packages/core/src/hosting.ts:2037,2239.
  • Option tables for secretStore / configStore (src/secret-resolve.ts:50-68), serverOrigin (src/constructs/front_door_options.ts:100-137) and the SSR cache options (src/constructs/cdn_construct.ts:810-963).
  • ### Streaming and buffered servers, a table by door and framework, the one statement of that rule.

Reordered: quick start and props, front doors, Next.js, SSR compute, build retention, access logging, SSR caching, custom domains, monitoring, secrets and config, errors. allowPlainHttp is stated once, under "Running a plain-HTTP door in production"; the other sections link to it.

Removed: ## Overview, ## Main exports, ## Architecture (the introduction and quick start cover them), ## Development, ## License, the link to #968, the reference D-016, and how a Web Function is packaged (code bucket key, revision ids, entry shim).

packages/hosting/CUSTOM-FRONT-DOOR.md

  • A failed wiring check throws UnsupportedFrontDoorError, whose message lists the unmet rules (packages/hosting/src/constructs/custom_door.ts:126,134,164).
  • The stacked example uses an HTTPS listener on 443 and an HTTPS_ONLY origin at a routerDomainName the reader supplies. The built-in stacked door rejects the plain-HTTP shape in production (packages/hosting/src/constructs/cloudfront_edge_door.ts:133-159).
  • A table of the eight cf.* helpers (src/constructs/cf_helpers.ts:195-310), with InvalidPropsError for cf.redirects / cf.headers (cf_helpers.ts:240,256).

packages/pipeline/README.md

  • new Pipeline() throws for an App scope, for appFile, for an async stageFactory and for a marker connectionArn (packages/pipeline/src/pipeline-construct.ts:172-196,364-370); a table compares it with Pipeline.create().
  • ## Options: tables for PipelineProps, source, branches[], stages[] and synth (src/types.ts, src/pipeline-construct.ts), plus the prefixes Pipeline from @aws-blocks/core defaults to (packages/core/src/pipeline/index.ts:33-41).
  • The first example is a complete aws-blocks/pipeline.cdk.ts with await Pipeline.create(app, ...).
File Lines Words Prose lines over 400 characters
packages/hosting/README.md 1669 → 1321 12969 → 10452 0 → 0
packages/hosting/CUSTOM-FRONT-DOOR.md (new) 0 → 253 0 → 1719 0 → 0
packages/pipeline/README.md 124 → 210 612 → 1535 0 → 0

The pipeline README grows because its props were not documented before. The hosting text as a whole (README plus the new file) goes from 1,669 to 1,574 lines.

Look hardest at:

  • The tables the READMEs did not have before: the 29 rows of ## Errors, HostingConstructProps, the store, serverOrigin and SSR cache options, and the pipeline options tables. Each row is a claim about the source.
  • The HTTPS stacked-door example in CUSTOM-FRONT-DOOR.md. It is standard CDK (certificates on addListener, HTTPS_ONLY) and was not synthesized.
  • The first pipeline example. As a complete file it is type-checked by the shipped-sample check (packages/blocks/src/test-support/doc-snippets.ts:19-23).
  • The new section order of the hosting README.

Not changed on purpose:

  • The upgrade steps for acceptLegacyVerifyHeader and the deprecated top-level props stay in the README, shortened: an app that still uses them needs the error names and the steps.

Open questions:

  • The pipeline README says to set cdk.json's app to the pipeline file, as test-apps/pipeline/cdk.json does. The app templates point at aws-blocks/index.cdk.ts; npx cdk synth --app … in synth.commands would keep both entry points usable. Which should the README recommend?
  • Should the acceptLegacyVerifyHeader upgrade steps, which are release-specific, move to a migration file?

Related pull requests: This supersedes the hosting part of #1496: the move of "Bring your own front door" is taken over unchanged as 74bea9719. Open pull requests that touch packages/hosting/README.md:

Whichever merges second rebases.

Part of a set of README revisions: #1635 (core), #1637 (bb-agent and bb-knowledge-base), #1638 (bb-auth and auth-common), #1639 (the storage blocks), #1640 (compute, jobs, realtime, email and observability), #1641 (the guide, the scaffolder and its templates), #1642 (the native SDKs), #1643 (contributor docs). Each merges on its own.

Validation

Run on this branch alone at 12190ddb7, on main 8940cfd2f, with Node 22. All pass:

  • npm run build
  • the shipped-docs tests in packages/blocks (readme-links, docs-pointers, doc-snippets, imports-reference)
  • packages/blocks sandbox-dir-coverage (no tracked file names the old directory .blocks-sandbox)
  • packages/core readme-policies (the IAM policy JSON)
  • packages/bb-auth readme-recipes, first-admin, multi-block-snippets, users-cli, gate-diagnostics
  • packages/auth-common ui.react-types
  • packages/bb-kv-store readme.generated (every README snippet compiled) and legacy/runtime
  • packages/create-blocks-app npm test
  • npm run sync-docs:check
  • npm run check:imports
  • changeset-guard.ts validate-structure
  • changeset-guard.ts verify-coverage
  • changeset-guard.ts verify-umbrella
  • changeset-guard.ts block-major
  • every relative link and #anchor in the changed files, and every link into them from another Markdown file, resolves (checked with a script)

Run once on all the README branches of this set combined, as they were on an earlier main commit (e1e484465), and not run again after the rebases: packages/core unit suite, packages/blocks unit suite, packages/bb-kv-store unit suite, packages/bb-auth unit suite, packages/auth-common unit suite, npm run lint, npm run lint:deps and npm run check:api. All passed.

Not run locally: the full npm test across all workspaces, npm run test:e2e:local and the sandbox e2e suites. CI runs them.

Files other than Markdown in this pull request: packages/hosting/package.json.

No test was added: the tests listed above already read these READMEs, and the remaining statements are checked against the source by review.

Checklist

  • PR description included
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@changeset-bot

changeset-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f74f277

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

This PR includes changesets to release 4 packages
Name Type
@aws-blocks/hosting Patch
@aws-blocks/pipeline Patch
@aws-blocks/blocks Patch
@aws-blocks/create-blocks-app 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

@osama-rizk osama-rizk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR moves the custom-door guide into its own file, adds props and errors tables to the hosting README, and documents every pipeline option. The tables are accurate and the corrections are real. I'm leaving comments, not blocking: a fact-by-fact comparison against main turned up a few dropped limitations and one security guarantee that should come back before merge, plus one row that is wrong for HostingConstruct users.

What's good

  • The StreamingServerNeedsStreamingDoorError correction for alb / stacked is right (hosting_construct.ts:3002-3015), and the single streaming table replaces three paragraphs that contradicted each other.
  • I checked every error name in ## Errors against its throw site. All 29 exist, and name === code holds (hosting_error.ts:17-24). The conditions I checked match the source: the skew range, 'none' with a server, geo type, the wiring check and the SSR cache errors.
  • The HostingConstructProps, adapter, serverOrigin, store and SSR-cache defaults match the source. The pipeline tables also match on every default and throw site.
  • CUSTOM-FRONT-DOOR.md ships in files[]. The wiring check now names the real error (custom_door.ts:164) and the real warning ids. The HTTPS stacked example type-checks against aws-cdk-lib 2 under tsc --strict, with only the @aws-blocks/hosting/constructs import stubbed.
  • Every anchor resolves, and nothing else in the repo links into a hosting README anchor that the restructure renamed.

What needs work: 3 should-fix · 8 minor · 3 nit, all non-blocking; details are inline.

Open questions

  1. Was dropping the Web Functions internals (the code bucket, content-derived revisions, the lambda:InvokeWebFunctionEndpoint custom resource) meant to remove them from the docs entirely? Or should they go to a packages/hosting/DESIGN.md, the per-block convention, since this README was where they were recorded?
  2. For the pipeline question in the description: since the AWS Blocks templates point cdk.json at aws-blocks/index.cdk.ts, I'd recommend npx cdk synth --app … in synth.commands. That keeps one cdk.json for local deploys and the pipeline. Whichever you choose, the first example should import Pipeline from @aws-blocks/core/cdk (inline).

Cross-cutting

  • The secrets limits (region, account-global prefix, stage not a security boundary) moved from a callout near the top to a plain list at the end, after monitoring. They're the most common deploy-time surprises. Consider keeping a one-line pointer to them from the Quick start or the props table row for secretStore/configStore.
  • The changeset is about 30 lines of public changelog for a docs patch, and it repeats the HTTP API claim flagged inline. A shorter list of the corrections would read better in CHANGELOG.md.
  • Naming follows the "AWS Blocks" convention throughout. The repo moved to aws/cdk-blocks, but the product name and the package.json URLs on main are unchanged, so nothing here needs renaming.

Comment thread packages/hosting/README.md Resolved
Comment thread packages/hosting/README.md Resolved
Comment thread packages/hosting/README.md Resolved
Comment thread packages/hosting/README.md Resolved
Comment thread packages/hosting/README.md Resolved
Comment thread packages/hosting/README.md Resolved
Comment thread packages/hosting/README.md Resolved
Comment thread packages/hosting/README.md Resolved
Comment thread packages/pipeline/README.md Resolved
Comment thread packages/pipeline/README.md Resolved
@xyos
xyos force-pushed the docs/readme-hosting-pipeline branch from 12190dd to 4df74fe Compare November 19, 2026 14:24
osama-rizk
osama-rizk previously approved these changes Nov 19, 2026

@osama-rizk osama-rizk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the last review: 14 resolved · 1 new · 0 still open

Approving. Every comment from the last review is fixed in 4df74fe, and I checked each fix against the source rather than the commit message. One new nit is inline as a follow-up.

The branch history was rewritten: the previously reviewed head 12190dd is no longer an ancestor, because the PR was rebased onto a newer main. So I compared the PR's own diff against its new merge base (f13a11c), not head to head. Apart from 4df74fe, the rebased commits are unchanged, except that the hosting README now keeps main's ## License section and its third-party notices paragraph.

Resolved (verified against source)

  • HTTP API row and bullets: these are now scoped to core Hosting, and the withBuildProfile recipe is given for HostingConstruct. withBuildProfile is exported from @aws-blocks/hosting/adapters (adapters/index.ts:23), and core passes serverInvoke: 'http-api' for that door (core/src/hosting.ts:1269-1271).
  • Open-redirect guarantee and redirect routing: restored. They match asset_proxy.test.ts:379-388 (/old//evil.example → /evil.example).
  • Untagged builds from pre-tagging releases: restored in the retention section.
  • Web Function internals: restored. The versioned bucket and web-function/<fn>/code.zip key, the content-derived revision ID, the HOST/PORT entry shim and the lambda:InvokeWebFunctionEndpoint custom resource all match web_function_construct.ts.
  • Cache-key caps: now stated as quota-relative (10 minus 2 or 5 reserved, raisable through quotas.*). This matches cdn_construct.ts:813-836 and quota_budget.ts:117-118.
  • Schema JSON-parse: now tied to the synth flag, not to typegen (secret-resolve.ts:351, secret-runtime.ts:67-70).
  • Codec compatibility boundary and the version rationale: restored.
  • Errors table: the five missing errors are added. Each condition matches its throw site, including the Web Function option ranges (web_function_construct.ts:570-592) and the behavior cap (cdn_construct.ts:1359).
  • ALB per-rule limits (MAX_CONDITION_VALUES = 5, MAX_RULE_WILDCARDS = 6) and the single API-scoped invoke permission: restored.
  • acceptLegacyVerifyHeader: the derivable-value warning is added.
  • Deprecated aliases: the same-template promise is back.
  • set: now reads "no overwrite confirmation".
  • Pipeline quick start: it imports Pipeline from @aws-blocks/core/cdk (as test-apps/pipeline does) and uses an explicit npx cdk synth --app …, so cdk.json stays on index.cdk.ts.
  • bakeTime: the row now says whole minutes, which matches toMinutes().
  • Body items: the changeset is shortened, and the secretStore/configStore row now links to the region, prefix and stage limits.

The HTTPS stacked example in CUSTOM-FRONT-DOOR.md is unchanged, and it still type-checks under tsc --strict against aws-cdk-lib 2.

What needs work: 1 nit, non-blocking. Details are inline.

Open questions: none.

Cross-cutting: the red Local Build and Checks job is not caused by this PR. check:headers flags 14 Dart files under native/dart/ that came from main (#1575), and Build and Test / Build, Unit Tests, E2E Local fail only because they depend on that job. This PR touches no source files.

Comment thread packages/hosting/README.md Resolved
xyos added 7 commits November 19, 2026 18:11
…R.md

The section is a guide for writing a door with defineFrontDoor, not for apps that pick a built-in door.
It moves verbatim into CUSTOM-FRONT-DOOR.md, which is added to the package's files.
The README keeps the heading, a summary, a link from the front-door table, and what AWS Blocks checks and enforces for such a door.
…ors before secrets and config

The README said a Next.js server behind the `alb` and `stacked` doors was "the exception" and should be served through CloudFront; it now says synth fails there with `StreamingServerNeedsStreamingDoorError`, and one table gives streaming and buffered behavior per door and framework.
Other corrections: `getSecret` throws `no secret reference found`, `HostingConstruct` is exported from `@aws-blocks/hosting/constructs`, the codec example imports the names it calls, and `allowPlainHttp` is listed among the door options.
The README had no quick start, no list of `HostingConstructProps` and no list of errors. It now has a `## Quick start` with adapter, entry-point and props tables, option tables for `secretStore` / `configStore`, `serverOrigin` and the SSR cache options, and an `## Errors` table of 29 `HostingError` names with the condition that throws each.
Sections are ordered quick start, front doors, Next.js, SSR compute, build retention, access logging, SSR caching, custom domains, monitoring, secrets and config, errors.
The `allowPlainHttp` rule and the streaming rule are each stated in one place, and the other sections link to it.
`## Overview`, `## Main exports`, `## Architecture`, `## Development`, `## License`, a pull request link, a decision reference and the description of how a Web Function is packaged are removed.
…s HTTPS in the stacked example

The guide said the wiring check fails synth "with `ServeStaticAsset`" or "with `ProxySameOriginApi`"; it throws `UnsupportedFrontDoorError`, and those are the rule names in its message.
The example of a door that stacks CloudFront over its own ALB sent the origin secret over plain HTTP to port 80; it now uses an HTTPS listener on 443 and an `HTTPS_ONLY` origin, and says why.
The `cf.*` helpers are in a table of eight rows, the three warnings of the wiring check are listed with their ids, and the shared exports are a list.
The two limits of the first example door (single-page-app deep links, request bodies to the server) are stated before the code.
…very prop

The README said only to use `Pipeline.create()` for async stage factories; `new Pipeline()` also throws for an `App` scope, for `appFile` and for a `config()` marker as `connectionArn`, and a table now compares the two forms.
The props were not documented. `## Options` now has tables for `PipelineProps`, `source`, `branches[]`, `stages[]` and `synth` with types and defaults, and states the store prefixes that `Pipeline` from `@aws-blocks/core` defaults to.
The first example is a complete `aws-blocks/pipeline.cdk.ts` that calls `await Pipeline.create(app, ...)` with the default `appFile` and a per-stage `environment`; the `stageFactory` form is the second example.
The one-time OAuth handshake of the CodeConnections connection is stated, and "Opt out of the Node.js 22 default" is folded into the `null` case of `synth.partialBuildSpec`.
xyos added 4 commits November 19, 2026 18:21
Keep the origin header and certificate hostname when switching to a VPC origin. Apply redirect and header rules to each behavior and require an ACL when the custom door enables WAF.
Distinguish cache quotas from hard limits. Show how to avoid reusing a backend module between pipeline stages, and clarify CodeBuild log masking and KMS permissions.
@xyos
xyos merged commit 8fbbeca into aws:main Nov 20, 2026
45 checks passed
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.

2 participants