Repository navigation
feat(core): run an API namespace on its own compute - #948
Merged
Merged
Conversation
ApiNamespace takes an optional fourth argument, { compute }, that runs the
namespace on a Compute instead of the app default. The namespace's compute
resolver (from #736) now prefers that option over the scope's compute, so the
shared gateway routes /aws-blocks/api/<export name> to it on every front door.
The option is typed structurally (resolve() → a serverless compute), so a
container Compute is a type error and core's default entry carries no CDK types.
E2E, one deploy per front door: comprehensive (apigateway tier, E2E
Sandbox/Production) and hosting-spa (Hosting's distribution) each get a
namespace on its own 512 MB Compute; a new test-apps/multi-compute app and
'E2E Multi-Compute' job cover the managed CloudFront tier.
Docs and changeset spell out the TS-client vs bare-endpoint routing, the gateway's ~29 s cap and serverless-only support; the umbrella test checks that no other method integrates the namespace's function; the multi-compute CI job tears down a left-behind stack.
…ient The cloudfront e2e calls through the real ApiNamespaceClient; the CI job assumes the E2E pool role like the other E2E jobs; the app ships its generated client and telemetry project id like the other test apps.
…e-api # Conflicts: # .github/workflows/pr-checks.yml
🦋 Changeset detectedLatest commit: e9afc4e The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
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 |
…e-api # Conflicts: # test-apps/hosting-spa/aws-blocks/index.ts # test-apps/hosting-spa/test/e2e.test.ts
…nt door #510 added the ALB leg; the comments named only the CloudFront distribution.
osama-rizk
previously approved these changes
Oct 26, 2026
…e-api # Conflicts: # .github/workflows/pr-checks.yml
osama-rizk
approved these changes
Oct 26, 2026
This was referenced Oct 27, 2026
This was referenced Oct 28, 2026
test(native): codegen fixtures 29-36 and 38, and the auth spec fixtures 18 and 23 (stack 05/24)
#854
Merged
Merged
Merged
Merged
3 tasks done
This branch was previously deployed
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.
Releases per-namespace compute to customers.
ApiNamespacetakes an optional fourth argument,{ compute }:The mechanism shipped in #736 (shared gateway fan-out by export name, per-namespace RPC paths), and #944 moved the native clients onto per-namespace paths. This PR adds the public option and wires it into the namespace's compute resolver.
Surface
ApiNamespaceOptions.computeis typed structurally ({ resolve(): { readonly type: 'serverless' } }) so core's default entry doesn't pull in CDK types; aComputeblock (or a raw backing) satisfies it. Acontainercompute is a type error for now.computethat belongs to anotherBlocksBackendcan't be routed by this backend's gateway: synth warns (blocks:apigateway:namespace-compute-not-owned, naming the export and the compute) and the namespace runs on the default compute. A compute inherited from the scope (the cached sub-module case) is still skipped silently.@aws-blocks/coreand@aws-blocks/blocks.API.mdadds onlyApiNamespaceOptions.Behaviour / limits (full list in the bb-compute README's API namespaces section; JSDoc and the changeset summarise it)
POST /aws-blocks/api/{export}, on every front door:apigateway,cloudfront, and behindHosting./aws-blocks/api(raw HTTP, or a native client from before feat(native): call each API namespace at its own path #944) runs on the default compute.maxTimeoutSeconds.Tests: one deployed e2e per front door
apigateway:test-apps/comprehensiveaddsisolatedApion its ownCompute(existing E2E Sandbox job).Hosting:test-apps/hosting-spatest 12 calls a namespace through Hosting, on both of its E2E Hosting legs: the CloudFront door, and the ALB door added by feat(hosting): swappable front doors + free-form bring-your-own front door #510 (verified locally, 13/13).cloudfront: the compute suite,test-apps/compute-smoke(E2E Compute Smoke). This PR folds the separate multi-compute app into it, so there's no extra deploy job:AsyncJobs; an API namespace on its own serverless compute, including the bare-endpoint call and the path/body mismatch). A harness deploys once and runs every module, like comprehensive'se2e.test.ts.COMPUTE_API_FRONT_DOOR, the way E2E Hosting usesHOSTING_COMPUTE_TYPE). Today there is one leg,cloudfront; the container-API work addsapigateway.bb-test-compute-*, so the scheduled cleanup and the CI role's E2E prefixes cover them (bb-compute-smoke-*wasn't covered).api.test.ts: precedence and laziness.shared-gateway.test.ts: the foreign-compute warning, and the silent inherited case.umbrella-compute.test.ts: BlocksStack, BlocksBackend and the cloudfront tier. Covers route by export name, memory, a shared AsyncJob, one API-scoped permission, no other method on the function, and compile-time container rejection.Verification beyond CI
reportson its own 512 MB function, andmain's clients land on the default one.Follow-ups (not in this PR)
ApiNamespaceConstructorso the API report shows its signature (predates this PR; adds a public type).