@ashishpandeyone/cdk-lambda-web-function 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.jsii CHANGED
@@ -9745,7 +9745,7 @@
9745
9745
  },
9746
9746
  "name": "@ashishpandeyone/cdk-lambda-web-function",
9747
9747
  "readme": {
9748
- "markdown": "# CDK constructs for AWS Lambda Web Functions\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n[AWS Lambda Web Functions](https://aws.amazon.com/lambda/) run an ordinary Node.js HTTP server (Express, Fastify, Hono, `node:http`) on Lambda and give it an HTTPS endpoint, optionally served from several regions. `WebFunction` deploys one, following the conventions of `aws-cdk-lib/aws-lambda` where the two services overlap.\n\n```ts fixture=bare\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport { WebFunction, WebFunctionAuthType, WebFunctionEndpointType } from '@ashishpandeyone/cdk-lambda-web-function';\n\nconst fn = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'Url', { value: fn.endpoint.url }); // https://<id>.lambda-web.global.on.aws\n```\n\nThe stack's region is the function's **home region**. Multi-region endpoints need a stack with an explicit `env.region`.\n\n## Writing the server\n\n1. Listen on the host and port in **`AWS_LAMBDA_HTTP_ENDPOINT`** (`0.0.0.0:3000` today). `PORT` is not set.\n2. Start listening within **about 9 seconds**, or initialisation fails with `Application.TimeoutListenError`.\n3. Put the entry file at the root of your bundle as **`index.js`**, or set `entrypoint`.\n4. The runtime has **no AWS SDK**: bundle the clients you import.\n5. Code runs on **arm64**.\n\n```js\nconst express = require('express');\n\nconst app = express();\napp.get('/', (req, res) => res.json({ hello: 'world', region: process.env.AWS_REGION }));\n\nconst [host, port] = process.env.AWS_LAMBDA_HTTP_ENDPOINT.split(':');\napp.listen(Number(port), host);\n```\n\nRequests carry `lambda-web-request-id` and `lambda-web-endpoint-name` headers.\n\n## Regions and endpoints\n\nEach `WebFunction` has a default endpoint, `fn.endpoint`, configured with the `endpoint` property. [Add more](#more-endpoints) with `fn.addEndpoint()`.\n\n| `endpointType` | URL | Routing |\n|---|---|---|\n| `HOME_REGION` (default) | `https://<id>.<cell>.lambda-web.<home>.on.aws` | home region only |\n| `MULTI_REGION` | one global `https://<id>.lambda-web.global.on.aws` | nearest region |\n| `PER_REGION` | one URL per region, from `fn.endpoint.regionalUrl(region)` | the region in the hostname |\n\n```ts\nconst perRegion = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.PER_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'UsEast1Url', { value: perRegion.endpoint.regionalUrl('us-east-1') });\n// perRegion.endpoint.regions is ['<home region>', 'eu-west-1', 'us-east-1']\n```\n\n- `MULTI_REGION` and `PER_REGION` need at least one region besides the home region; `HOME_REGION` takes none.\n- A MultiRegion endpoint takes about a minute to create.\n- Lambda routes a `MULTI_REGION` endpoint by latency, not by health: it doesn't fail over when a region has problems.\n\n### More endpoints\n\nA function can have up to 10 endpoints, each with its own URL, authentication, regions and limits. For example, a public endpoint next to an IAM-only global one:\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.NONE, // the default endpoint is public\n endpoint: { rateLimit: 1000 }, // requests per second\n});\n\nconst internal = api.addEndpoint('Internal', {\n authType: WebFunctionAuthType.AWS_IAM,\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n description: 'Service-to-service traffic',\n maxEnvironments: 50,\n});\ninternal.grantInvoke(consumerRole);\nnew CfnOutput(this, 'InternalUrl', { value: internal.url });\n```\n\n- `rateLimit` takes 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000; excess requests get HTTP 429. `maxEnvironments` takes 2–10,000.\n- **Both limits apply separately in each region** an endpoint serves from: a 3-region endpoint with `rateLimit: 1000` accepts up to 1,000 requests per second in each region.\n- Endpoints can serve the same regions. The construct owns one `.local` log group per region, whichever endpoints serve it.\n\n### Changing regions or the endpoint type\n\nAn endpoint's type and regions can't change in place: a change creates a **new endpoint with a new URL**, and the old one is deleted once the new one is live. Two endpoints of one function can't share a name, so:\n\n| `endpointName` | Physical name | Changing `regions` or `endpointType` |\n|---|---|---|\n| omitted (recommended) | `default-<hash>` for `fn.endpoint`, `<id>-<hash>` for added endpoints; the hash covers the type and regions | works: new endpoint, new URL |\n| set, e.g. `'live'` | `live` | also change the name in the same deployment, or it fails with *The endpoint live already exists* (the stack rolls back and the old endpoint keeps serving) |\n\nThe construct warns at synth time when `endpointName` is set.\n\n## Authentication and invoking\n\n| `authType` | Meaning |\n|---|---|\n| `AWS_IAM` | Callers sign requests (SigV4 or SigV4a, signing name `lambda`) and need `lambda:InvokeWebFunctionEndpoint` |\n| `NONE` | **Public**: Lambda does no authentication; your application does (JWT, sessions). The `Authorization` header reaches your application untouched. The construct warns at synth time |\n\n```ts\nfn.grants.invoke(consumerRole); // or fn.grantInvoke(consumerRole), as on lambda.Function\n```\n\nThe grant is on the endpoint's home-region ARN, which IAM evaluates in every region the endpoint serves from, including the global URL. `fn.grants` covers the default endpoint only; grant other endpoints with their own `grantInvoke()` or `grants.invoke()`.\n\n| Endpoint | How to sign |\n|---|---|\n| `HOME_REGION` | SigV4 for the home region |\n| `PER_REGION` | SigV4 for the hostname's region, or SigV4a |\n| `MULTI_REGION` | **SigV4a with region set `*`**: you can't know which region will serve the request |\n\n```js\nimport { SignatureV4a } from '@smithy/signature-v4a';\nimport { Sha256 } from '@aws-crypto/sha256-js';\nimport { fromNodeProviderChain } from '@aws-sdk/credential-providers';\n\nconst signer = new SignatureV4a({ service: 'lambda', region: '*', sha256: Sha256, credentials: fromNodeProviderChain() });\nconst signed = await signer.sign(\n { method: 'GET', protocol: 'https:', hostname: host, path: '/', headers: { host } },\n { signingRegion: '*' },\n);\nconst response = await fetch(`https://${host}/`, { headers: signed.headers });\n```\n\n## Configuration\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('build'),\n authType: WebFunctionAuthType.AWS_IAM,\n entrypoint: 'server.js', // default index.js\n webFunctionName: 'orders-api', // default: generated from the construct path\n description: 'Orders HTTP API',\n environment: { TABLE_NAME: table.tableName },\n timeout: Duration.seconds(60), // per request: 3 seconds to 15 minutes, default 30 seconds\n maxConcurrencyPerEnvironment: 32, // requests per environment at once: 1-128, default 64\n});\n\napi.addEnvironment('FEATURE_FLAG', 'on');\ntable.grantReadWriteData(api); // the default role trusts lambda.amazonaws.com\n```\n\n- Requests handled by one environment share module-level state, so keep handlers concurrency-safe.\n- Environment variable names starting with `AWS_` are reserved.\n- **Renaming the function replaces it and changes its URL.** A generated name depends on the construct path, so moving the construct renames it too.\n\n### Bundling TypeScript with `NodejsWebFunction`\n\n`NodejsWebFunction` is a `WebFunction` that bundles your server from a TypeScript or JavaScript entry file with esbuild, like `NodejsFunction` does for Lambda functions:\n\n```ts\nnew NodejsWebFunction(this, 'Api', {\n entry: 'src/server.ts',\n authType: WebFunctionAuthType.AWS_IAM,\n bundling: {\n minify: true, // default true\n sourceMap: true, // default true\n format: lambdaNodejs.OutputFormat.ESM, // default ESM (index.mjs); CJS gives index.js\n externalModules: [], // default: bundle everything you import\n },\n});\n```\n\n- **Defaults:** `runtime` is `NODEJS_24_X`, and the esbuild target follows the runtime (`node24`). The project root is the directory of the nearest lock file above `entry` (override it with `depsLockFilePath` or `projectRoot`).\n- **It also sets what a `lambda.Code` can't:** the entry point that matches the bundle, and `NODE_OPTIONS=--enable-source-maps` when source maps are on, appended to any `NODE_OPTIONS` you set, so stack traces point at your `.ts` files (e.g. `/var/task/src/server.ts:22:12`). Source map paths are relative to the project root, so no build-machine paths are deployed.\n- **ESM bundles include a `require` shim**, so CommonJS dependencies that load Node.js built-ins (Express, for example) work.\n- **The AWS SDK is bundled like any other dependency**, since the runtime has none. Only the clients you import are included.\n- **Bundling runs locally** when esbuild is installed in your project, and otherwise in Docker (an arm64 AWS SAM build image; set `forceDockerBundling` to always use Docker).\n- **Not yet supported:** installing native modules next to the bundle (`nodeModules`) and command hooks. For native dependencies, use `WebFunction` with `Code.fromAsset(..., { bundling: { image, command } })`.\n\n### Code\n\n`code` takes any `lambda.Code` that produces a zip in S3: `fromAsset`, `fromBucket`/`fromBucketV2`, `fromCustomCommand`, `fromDockerBuild`. Inline code and container images fail at synth time.\n\nLambda Web Functions download code as the `lambda.amazonaws.com` service principal, from a **versioned** bucket, and the CDK bootstrap bucket allows neither. So each stack gets a small code bucket, and the code is copied into it on deploy.\n\n## Revisions\n\nAny change to code or configuration creates a new **revision** (`fn.currentRevision`), and endpoints switch to it once it's ready. A failed deployment rolls back to the previous revision. If nothing changed, nothing is deployed.\n\nEarlier revisions are kept, so you can roll back or route traffic to them. After each deployment, the construct deletes the oldest beyond `revisionRetention` (default 20, up to 50). It never deletes a revision an endpoint routes to, or one the previous deployment used, which a rollback returns to.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n revisionRetention: 5,\n});\n```\n\n### Routing to earlier revisions\n\nReference an earlier revision by its ID (for example from a `CfnOutput` of `fn.currentRevision.revisionId`, or `aws lambda-web list-web-function-revisions`). Then pin an endpoint to it, or split traffic between two revisions:\n\n```ts\nconst previous = WebFunctionRevision.fromRevisionAttributes(this, 'Previous', {\n webFunction: fn,\n revisionId: 'rev-a1b2c',\n});\n\n// Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.endpoint.routeTraffic(previous, [{ revision: fn.currentRevision, weight: 0.1 }]);\n\n// Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.addEndpoint('Stable', { authType: WebFunctionAuthType.AWS_IAM, revision: previous });\n```\n\n- An endpoint routes to at most two revisions. The additional revision's `weight` is a whole percentage, from 0.01 to 0.99.\n- To promote, remove `routeTraffic` (or `revision`) and deploy: the endpoint serves the current revision again.\n- Lambda Web Function metrics have no revision dimension. To compare a split's revisions, log a version you control (for example an environment variable) from your application.\n\n### Canary and linear deployments\n\nBy default an endpoint moves all its traffic to a new revision at once. With `deployment`, it moves in steps instead, watching CloudWatch alarms: if one goes into ALARM, the endpoint goes back to the revision it served before and the deployment fails, so CloudFormation rolls the stack back.\n\n```ts\n// errorRate: a cloudwatch.IAlarm, for example on the share of 5xx responses\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n // 10% of the traffic for 10 minutes, then all of it.\n deployment: WebFunctionDeployment.canary({ percent: 10, bake: Duration.minutes(10), alarms: [errorRate] }),\n },\n});\n\n// 25% more every 5 minutes. Each endpoint has its own deployment.\napi.addEndpoint('Public', {\n authType: WebFunctionAuthType.NONE,\n deployment: WebFunctionDeployment.linear({ percent: 25, interval: Duration.minutes(5), alarms: [errorRate] }),\n});\n```\n\n| | Steps | Limits |\n|---|---|---|\n| `allAtOnce()` (default) | 100% | |\n| `canary({ percent, bake })` | `percent`, then 100% after `bake` | `percent` 1–99, `bake` 1–45 minutes |\n| `linear({ percent, interval })` | `percent` more every `interval` | `percent` 5–50, `interval` from 1 minute, at most 45 minutes in all |\n\nHow it works:\n\n- Each deployment that creates a revision (code or configuration) moves the traffic from the revision the endpoint serves at that moment, which is also what it goes back to. If someone switched the endpoint outside CloudFormation, the deployment starts from there.\n- Each step waits until every region of a `MULTI_REGION` or `PER_REGION` endpoint has applied it (usually about 15 seconds), and if a region fails to update, the endpoint goes back as for an alarm. The bake or interval counts from the start of the step.\n- Alarms are checked before the first step (an alarm already in ALARM stops the deployment before any traffic moves), throughout every step, and once the new revision has all the traffic. They can be in any region, and composite alarms work. `INSUFFICIENT_DATA` doesn't stop a deployment.\n- A rollback of the stack, for any reason, moves the traffic back at once, without waiting or checking alarms.\n- A stack's first deployment, and a new endpoint (including one renamed by a region change), serve the revision at once: there's nothing to move from.\n- A deployment can take up to an hour: CloudFormation waits for it before it updates the endpoint. Deployments of different endpoints run in parallel.\n- A canary or linear endpoint always moves to the current revision, so it can't also use `revision`, `additionalRevisions` or `routeTraffic()`. Use `allAtOnce()` to deploy a fix immediately, for example while an alarm is in ALARM.\n\nLambda Web Function metrics have no revision dimension, so an alarm sees the whole endpoint: at 10%, a new revision's errors are a tenth of the endpoint's. Alarm on a rate, with a threshold low enough to notice that, or publish metrics from your application that carry its version. A bake should be longer than an alarm needs to fire (its period times its evaluation periods).\n\nThe deployment runs in a few resources per stack, created on first use: two Lambda functions, a Step Functions state machine that calls them every 15 seconds, and a log group.\n\n## Logs in every region\n\nWeb Functions log in two tiers:\n\n```text\n every serving region home region\n ┌──────────────────┐ ┌──────────────────────────────────────────┐\n │ <group>.local │── copied ───►│ <group> every region's logs │\n │ (that region's │ (seconds) │ streams …[rev]<instance>-<acct>-<region> │\n │ environments) │ │ <group>.local (home-region traffic) │\n └──────────────────┘ └──────────────────────────────────────────┘\n```\n\n**Query `fn.logGroup`**, the home-region group that receives every region's logs. The service would create missing groups without retention and never delete them, so the construct creates and owns all of them: both home-region groups, and `<group>.local` in every other region of the endpoint.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n logRetention: logs.RetentionDays.THREE_MONTHS, // default ONE_MONTH, every group in every region\n logRemovalPolicy: RemovalPolicy.DESTROY, // default RETAIN\n applicationLogLevelV2: lambda.ApplicationLogLevel.WARN,\n systemLogLevelV2: lambda.SystemLogLevel.INFO, // DEBUG, INFO or WARN\n});\n```\n\n- The default group is `/aws/lambda/web/<function name>`. Log lines are JSON; application lines carry `requestId`, `endpointName` and `region`.\n- Every event is stored twice (`.local` plus the home-region copy), so expect about double log ingestion, plus cross-region transfer.\n- With `DESTROY`, deletion waits about a minute after the function is gone, because environments flush their last lines late.\n- Subscribe only to `fn.logGroup`: subscribing to the `.local` groups as well delivers every event twice.\n\n## Limitations\n\n- Not yet supported: importing existing functions, VPC access (network connectors), resource-policy permissions, KMS encryption, metrics helpers, tracing, and a CloudFront origin.\n- `cdk deploy --hotswap` and `cdk watch` don't support Web Functions.\n- Quotas: 10 endpoints and about 50 revisions per function (Lambda cleans up older revisions automatically), and 10,000 requests per second per endpoint. Per account and region: 100,000 requests per second and 2,000 Arm64 vCPUs (each execution environment uses 2). The account quotas are adjustable, and new accounts start lower. See [Lambda quotas](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html).\n- The stack's custom resource provider Lambda keeps its own log group after the stack is deleted, as with other CDK custom resources.\n\n## Development\n\nTooling is pinned in `mise.toml` (Node 24, AWS CDK CLI). Personal settings, such as the AWS profile for the live end-to-end tests, go in a git-ignored `mise.local.toml`.\n\n```bash\nmise install\nnpx projen build # compile, unit tests, lint, API docs\nnpx projen e2e # deploy, verify and destroy real stacks in three regions (needs AWS credentials)\n```\n"
9748
+ "markdown": "# CDK constructs for AWS Lambda Web Functions\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n[AWS Lambda Web Functions](https://aws.amazon.com/lambda/) run an ordinary Node.js HTTP server (Express, Fastify, Hono, `node:http`) on Lambda and give it an HTTPS endpoint, optionally served from several regions. `WebFunction` deploys one, following the conventions of `aws-cdk-lib/aws-lambda` where the two services overlap.\n\n```ts fixture=bare\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport { WebFunction, WebFunctionAuthType, WebFunctionEndpointType } from '@ashishpandeyone/cdk-lambda-web-function';\n\nconst fn = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'Url', { value: fn.endpoint.url }); // https://<id>.lambda-web.global.on.aws\n```\n\nThe stack's region is the function's **home region**. Multi-region endpoints need a stack with an explicit `env.region`.\n\n## Writing the server\n\n1. Listen on the host and port in **`AWS_LAMBDA_HTTP_ENDPOINT`** (`0.0.0.0:3000` today). `PORT` is not set.\n2. Start listening within **about 9 seconds**, or initialisation fails with `Application.TimeoutListenError`.\n3. Put the entry file at the root of your bundle as **`index.js`**, or set `entrypoint`.\n4. The runtime has **no AWS SDK**: bundle the clients you import.\n5. Code runs on **arm64**.\n\n```js\nconst express = require('express');\n\nconst app = express();\napp.get('/', (req, res) => res.json({ hello: 'world', region: process.env.AWS_REGION }));\n\nconst [host, port] = process.env.AWS_LAMBDA_HTTP_ENDPOINT.split(':');\napp.listen(Number(port), host);\n```\n\nRequests carry `lambda-web-request-id` and `lambda-web-endpoint-name` headers.\n\n## Regions and endpoints\n\nEach `WebFunction` has a default endpoint, `fn.endpoint`, configured with the `endpoint` property. [Add more](#more-endpoints) with `fn.addEndpoint()`.\n\n| `endpointType` | URL | Routing |\n|---|---|---|\n| `HOME_REGION` (default) | `https://<id>.<cell>.lambda-web.<home>.on.aws` | home region only |\n| `MULTI_REGION` | one global `https://<id>.lambda-web.global.on.aws` | nearest region |\n| `PER_REGION` | one URL per region, from `fn.endpoint.regionalUrl(region)` | the region in the hostname |\n\n```ts\nconst perRegion = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.PER_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'UsEast1Url', { value: perRegion.endpoint.regionalUrl('us-east-1') });\n// perRegion.endpoint.regions is ['<home region>', 'eu-west-1', 'us-east-1']\n```\n\n- `MULTI_REGION` and `PER_REGION` need at least one region besides the home region; `HOME_REGION` takes none.\n- A MultiRegion endpoint takes about a minute to create.\n- Lambda routes a `MULTI_REGION` endpoint by latency, not by health: it doesn't fail over when a region has problems.\n\n### More endpoints\n\nA function can have up to 10 endpoints, each with its own URL, authentication, regions and limits. For example, a public endpoint next to an IAM-only global one:\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.NONE, // the default endpoint is public\n endpoint: { rateLimit: 1000 }, // requests per second\n});\n\nconst internal = api.addEndpoint('Internal', {\n authType: WebFunctionAuthType.AWS_IAM,\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n description: 'Service-to-service traffic',\n maxEnvironments: 50,\n});\ninternal.grantInvoke(consumerRole);\nnew CfnOutput(this, 'InternalUrl', { value: internal.url });\n```\n\n- `rateLimit` takes 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000; excess requests get HTTP 429. `maxEnvironments` takes 2–10,000.\n- **Both limits apply separately in each region** an endpoint serves from: a 3-region endpoint with `rateLimit: 1000` accepts up to 1,000 requests per second in each region.\n- Endpoints can serve the same regions. The construct owns one `.local` log group per region, whichever endpoints serve it.\n\n### Changing regions or the endpoint type\n\nAn endpoint's type and regions can't change in place: a change creates a **new endpoint with a new URL**, and the old one is deleted once the new one is live. Two endpoints of one function can't share a name, so:\n\n| `endpointName` | Physical name | Changing `regions` or `endpointType` |\n|---|---|---|\n| omitted (recommended) | `default-<hash>` for `fn.endpoint`, `<id>-<hash>` for added endpoints; the hash covers the type and regions | works: new endpoint, new URL |\n| set, e.g. `'live'` | `live` | also change the name in the same deployment, or it fails with *The endpoint live already exists* (the stack rolls back and the old endpoint keeps serving) |\n\nThe construct warns at synth time when `endpointName` is set.\n\n## Authentication and invoking\n\n| `authType` | Meaning |\n|---|---|\n| `AWS_IAM` | Callers sign requests (SigV4 or SigV4a, signing name `lambda`) and need `lambda:InvokeWebFunctionEndpoint` |\n| `NONE` | **Public**: Lambda does no authentication; your application does (JWT, sessions). The `Authorization` header reaches your application untouched. The construct warns at synth time |\n\n```ts\nfn.grants.invoke(consumerRole); // or fn.grantInvoke(consumerRole), as on lambda.Function\n```\n\nThe grant is on the endpoint's home-region ARN, which IAM evaluates in every region the endpoint serves from, including the global URL. `fn.grants` covers the default endpoint only; grant other endpoints with their own `grantInvoke()` or `grants.invoke()`.\n\n| Endpoint | How to sign |\n|---|---|\n| `HOME_REGION` | SigV4 for the home region |\n| `PER_REGION` | SigV4 for the hostname's region, or SigV4a |\n| `MULTI_REGION` | **SigV4a with region set `*`**: you can't know which region will serve the request |\n\n```js\nimport { SignatureV4a } from '@smithy/signature-v4a';\nimport { Sha256 } from '@aws-crypto/sha256-js';\nimport { fromNodeProviderChain } from '@aws-sdk/credential-providers';\n\nconst signer = new SignatureV4a({ service: 'lambda', region: '*', sha256: Sha256, credentials: fromNodeProviderChain() });\nconst signed = await signer.sign(\n { method: 'GET', protocol: 'https:', hostname: host, path: '/', headers: { host } },\n { signingRegion: '*' },\n);\nconst response = await fetch(`https://${host}/`, { headers: signed.headers });\n```\n\n## Configuration\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('build'),\n authType: WebFunctionAuthType.AWS_IAM,\n entrypoint: 'server.js', // default index.js\n webFunctionName: 'orders-api', // default: generated from the construct path\n description: 'Orders HTTP API',\n environment: { TABLE_NAME: table.tableName },\n timeout: Duration.seconds(60), // per request: 3 seconds to 15 minutes, default 30 seconds\n maxConcurrencyPerEnvironment: 32, // requests per environment at once: 1-128, default 64\n});\n\napi.addEnvironment('FEATURE_FLAG', 'on');\ntable.grantReadWriteData(api); // the default role trusts lambda.amazonaws.com\n```\n\n- Requests handled by one environment share module-level state, so keep handlers concurrency-safe.\n- Environment variable names starting with `AWS_` are reserved.\n- **Renaming the function replaces it and changes its URL.** A generated name depends on the construct path, so moving the construct renames it too.\n\n### Bundling TypeScript with `NodejsWebFunction`\n\n`NodejsWebFunction` is a `WebFunction` that bundles your server from a TypeScript or JavaScript entry file with esbuild, like `NodejsFunction` does for Lambda functions:\n\n```ts\nnew NodejsWebFunction(this, 'Api', {\n entry: 'src/server.ts',\n authType: WebFunctionAuthType.AWS_IAM,\n bundling: {\n minify: true, // default true\n sourceMap: true, // default true\n format: lambdaNodejs.OutputFormat.ESM, // default ESM (index.mjs); CJS gives index.js\n externalModules: [], // default: bundle everything you import\n },\n});\n```\n\n- **Defaults:** `runtime` is `NODEJS_24_X`, and the esbuild target follows the runtime (`node24`). The project root is the directory of the nearest lock file above `entry` (override it with `depsLockFilePath` or `projectRoot`).\n- **It also sets what a `lambda.Code` can't:** the entry point that matches the bundle, and `NODE_OPTIONS=--enable-source-maps` when source maps are on, appended to any `NODE_OPTIONS` you set, so stack traces point at your `.ts` files (e.g. `/var/task/src/server.ts:22:12`). Source map paths are relative to the project root, so no build-machine paths are deployed.\n- **ESM bundles include a `require` shim**, so CommonJS dependencies that load Node.js built-ins (Express, for example) work.\n- **The AWS SDK is bundled like any other dependency**, since the runtime has none. Only the clients you import are included.\n- **Bundling runs locally** when esbuild is installed in your project, and otherwise in Docker (an arm64 AWS SAM build image; set `forceDockerBundling` to always use Docker).\n- **Not yet supported:** installing native modules next to the bundle (`nodeModules`) and command hooks. For native dependencies, use `WebFunction` with `Code.fromAsset(..., { bundling: { image, command } })`.\n\n### Code\n\n`code` takes any `lambda.Code` that produces a zip in S3: `fromAsset`, `fromBucket`/`fromBucketV2`, `fromCustomCommand`, `fromDockerBuild`. Inline code and container images fail at synth time.\n\nLambda Web Functions download code as the `lambda.amazonaws.com` service principal, from a **versioned** bucket, and the CDK bootstrap bucket allows neither. So each stack gets a small code bucket, and the code is copied into it on deploy.\n\n## Revisions\n\nAny change to code or configuration creates a new **revision** (`fn.currentRevision`), and endpoints switch to it once it's ready. A failed deployment rolls back to the previous revision. If nothing changed, nothing is deployed.\n\nEarlier revisions are kept, so you can roll back or route traffic to them. After each deployment, the construct deletes the oldest beyond `revisionRetention` (default 20, up to 50). It never deletes a revision an endpoint routes to, or one the previous deployment used, which a rollback returns to.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n revisionRetention: 5,\n});\n```\n\n### Routing to earlier revisions\n\nReference an earlier revision by its ID (for example from a `CfnOutput` of `fn.currentRevision.revisionId`, or `aws lambda-web list-web-function-revisions`). Then pin an endpoint to it, or split traffic between two revisions:\n\n```ts\nconst previous = WebFunctionRevision.fromRevisionAttributes(this, 'Previous', {\n webFunction: fn,\n revisionId: 'rev-a1b2c',\n});\n\n// Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.endpoint.routeTraffic(previous, [{ revision: fn.currentRevision, weight: 0.1 }]);\n\n// Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.addEndpoint('Stable', { authType: WebFunctionAuthType.AWS_IAM, revision: previous });\n```\n\n- An endpoint routes to at most two revisions. The additional revision's `weight` is a whole percentage, from 0.01 to 0.99.\n- To promote, remove `routeTraffic` (or `revision`) and deploy: the endpoint serves the current revision again.\n- Lambda Web Function metrics have no revision dimension. To compare a split's revisions, log a version you control (for example an environment variable) from your application.\n\n### Canary and linear deployments\n\nBy default an endpoint moves all its traffic to a new revision at once. With `deployment`, it moves in steps instead, watching CloudWatch alarms: if one goes into ALARM, the endpoint goes back to the revision it served before and the deployment fails, so CloudFormation rolls the stack back.\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n // 10% of the traffic for 10 minutes, then all of it; back if more than 2% of requests get a 5XX.\n deployment: WebFunctionDeployment.canary({ percent: 10, bake: Duration.minutes(10), rollbackOn: { serverErrorRate: 2 } }),\n },\n});\n\n// 25% more every 5 minutes, watching an alarm of your own. Each endpoint has its own deployment.\n// errorRate: any cloudwatch.IAlarm, e.g. on a metric your application publishes.\napi.addEndpoint('Public', {\n authType: WebFunctionAuthType.NONE,\n deployment: WebFunctionDeployment.linear({ percent: 25, interval: Duration.minutes(5), alarms: [errorRate] }),\n});\n```\n\n| | Steps | Limits |\n|---|---|---|\n| `allAtOnce()` (default) | 100% | |\n| `canary({ percent, bake })` | `percent`, then 100% after `bake` | `percent` 1–99, `bake` 1–45 minutes |\n| `linear({ percent, interval })` | `percent` more every `interval` | `percent` 5–50, `interval` from 1 minute, at most 45 minutes in all |\n\nHow it works:\n\n- Each deployment that creates a revision (code or configuration) moves the traffic from the revision the endpoint serves at that moment, which is also what it goes back to. If someone switched the endpoint outside CloudFormation, the deployment starts from there.\n- Each step waits until every region of a `MULTI_REGION` or `PER_REGION` endpoint has applied it (usually about 15 seconds), and if a region fails to update, the endpoint goes back as for an alarm. The bake or interval counts from the start of the step.\n- Alarms are checked before the first step (an alarm already in ALARM stops the deployment before any traffic moves), throughout every step, and once the new revision has all the traffic. They can be in any region, and composite alarms work. `INSUFFICIENT_DATA` doesn't stop a deployment.\n- A rollback of the stack, for any reason, moves the traffic back at once, without waiting or checking alarms.\n- A stack's first deployment, and a new endpoint (including one renamed by a region change), serve the revision at once: there's nothing to move from.\n- A deployment can take up to an hour: CloudFormation waits for it before it updates the endpoint. Deployments of different endpoints run in parallel.\n- A canary or linear endpoint always moves to the current revision, so it can't also use `revision`, `additionalRevisions` or `routeTraffic()`. Use `allAtOnce()` to deploy a fix immediately, for example while an alarm is in ALARM.\n\n#### Rollback alarms\n\n`rollbackOn` makes the endpoint create alarms on its own error rates, and the deployment watches them alongside any `alarms` you pass:\n\n| `rollbackOn` | Default | |\n|---|---|---|\n| `serverErrorRate` | none | roll back when more than this % of requests get a 5XX |\n| `clientErrorRate` | none | the same for 4XX (including 429s from `rateLimit` and `maxEnvironments`) |\n| `minimumRequests` | 10 | periods with fewer requests don't count, so one failed request out of two doesn't roll back |\n| `period`, `evaluationPeriods` | 1 minute, 2 | consecutive periods over the threshold before rolling back |\n\n- **One alarm per threshold in every region the endpoint serves from.** Metrics are published in the region that served the request, and an alarm can only watch metrics in its own region. The home region's alarm is a normal CloudFormation alarm; the others are created and deleted with the endpoint by a custom resource, and named `LambdaWeb-<function>-<endpoint>-5xx-rate` (or `-4xx-rate`). `endpoint.rollbackAlarms` lists them all, e.g. to add notifications to the home region's.\n- **The alarms see the whole endpoint.** Lambda Web Function metrics have no revision dimension, so at 10% a new revision's errors are about a tenth of the endpoint's: set the threshold low enough to notice that, or alarm on metrics your application publishes with its version.\n- **5XX includes the platform's 503s** while the endpoint scales up for a sudden burst, not only your application's errors.\n- **A step should outlast the alarm.** CloudWatch needs `period` × `evaluationPeriods`, plus a couple of minutes of delay, to fire; the construct warns when a canary's bake or a linear interval is shorter.\n\nThe deployment runs in a few resources per stack, created on first use: two Lambda functions, a Step Functions state machine that calls them every 15 seconds, and a log group.\n\n## Metrics\n\nEndpoints and functions have helpers for their CloudWatch metrics (namespace `AWS/Lambda/Web`), like `lambda.Function`'s:\n\n```ts\nfn.endpoint.metricServerErrorRate().createAlarm(this, 'ErrorRate', { threshold: 1, evaluationPeriods: 3 });\nfn.endpoint.metricRequestThrottles().createAlarm(this, 'Throttled', { threshold: 10, evaluationPeriods: 3 });\nfn.metricConcurrentRequests().createAlarm(this, 'Saturated', { threshold: 60, evaluationPeriods: 3 });\n```\n\n| Endpoint | Metric |\n|---|---|\n| `metricRequests()` | `ExecutedRequests` (there's no separate 2XX count) |\n| `metricClientErrors()`, `metricServerErrors()` | `HTTPResponseStatusClass4XX`, `HTTPResponseStatusClass5XX` |\n| `metricClientErrorRate()`, `metricServerErrorRate()` | 4XX or 5XX as a % of requests (math expression) |\n| `metricActiveEnvironments()` | `EndpointActiveEnvironments`, to compare with `maxEnvironments` |\n| `metricRequestThrottles()`, `metricEnvironmentThrottles()` | 429s from `rateLimit` and from `maxEnvironments` |\n\n| Function | Metric |\n|---|---|\n| `metricConcurrentRequests()` | `EnvironmentConcurrentRequests` (maximum), to compare with `maxConcurrencyPerEnvironment` |\n| `metricMaxMemoryUsage()` | `EnvironmentMaxMemoryUsage` (maximum) |\n| `metricActiveTime()`, `metricCpuTime()`, `metricResponseBytes()` | `EnvironmentActiveTime`, `EnvironmentCPUTime`, `ResponseBytes` |\n\n- **Metrics stay in the region that served the request**; unlike logs, they aren't copied to the home region. Every helper takes `region`. Dashboards can show any region, but an alarm can only use metrics from its own stack's region.\n- 4XX, 5XX and the throttle metrics only exist once they're non-zero: alarm on them with `treatMissingData: NOT_BREACHING`. The rate helpers count missing errors as 0.\n- There's no latency metric. Publish one from your application (e.g. with the CloudWatch embedded metric format).\n\n## Logs in every region\n\nWeb Functions log in two tiers:\n\n```text\n every serving region home region\n ┌──────────────────┐ ┌──────────────────────────────────────────┐\n │ <group>.local │── copied ───►│ <group> every region's logs │\n │ (that region's │ (seconds) │ streams …[rev]<instance>-<acct>-<region> │\n │ environments) │ │ <group>.local (home-region traffic) │\n └──────────────────┘ └──────────────────────────────────────────┘\n```\n\n**Query `fn.logGroup`**, the home-region group that receives every region's logs. The service would create missing groups without retention and never delete them, so the construct creates and owns all of them: both home-region groups, and `<group>.local` in every other region of the endpoint.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n logRetention: logs.RetentionDays.THREE_MONTHS, // default ONE_MONTH, every group in every region\n logRemovalPolicy: RemovalPolicy.DESTROY, // default RETAIN\n applicationLogLevelV2: lambda.ApplicationLogLevel.WARN,\n systemLogLevelV2: lambda.SystemLogLevel.INFO, // DEBUG, INFO or WARN\n});\n```\n\n- The default group is `/aws/lambda/web/<function name>`. Log lines are JSON; application lines carry `requestId`, `endpointName` and `region`.\n- Every event is stored twice (`.local` plus the home-region copy), so expect about double log ingestion, plus cross-region transfer.\n- With `DESTROY`, deletion waits about a minute after the function is gone, because environments flush their last lines late.\n- Subscribe only to `fn.logGroup`: subscribing to the `.local` groups as well delivers every event twice.\n\n## Limitations\n\n- Not yet supported: importing existing functions, VPC access (network connectors), resource-policy permissions, KMS encryption, metrics helpers, tracing, and a CloudFront origin.\n- `cdk deploy --hotswap` and `cdk watch` don't support Web Functions.\n- Quotas: 10 endpoints and about 50 revisions per function (Lambda cleans up older revisions automatically), and 10,000 requests per second per endpoint. Per account and region: 100,000 requests per second and 2,000 Arm64 vCPUs (each execution environment uses 2). The account quotas are adjustable, and new accounts start lower. See [Lambda quotas](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html).\n- The stack's custom resource provider Lambda keeps its own log group after the stack is deleted, as with other CDK custom resources.\n\n## Development\n\nTooling is pinned in `mise.toml` (Node 24, AWS CDK CLI). Personal settings, such as the AWS profile for the live end-to-end tests, go in a git-ignored `mise.local.toml`.\n\n```bash\nmise install\nnpx projen build # compile, unit tests, lint, API docs\nnpx projen e2e # deploy, verify and destroy real stacks in three regions (needs AWS credentials)\n```\n"
9749
9749
  },
9750
9750
  "repository": {
9751
9751
  "type": "git",
@@ -9772,7 +9772,7 @@
9772
9772
  "kind": "interface",
9773
9773
  "locationInModule": {
9774
9774
  "filename": "src/web-function-endpoint.ts",
9775
- "line": 105
9775
+ "line": 112
9776
9776
  },
9777
9777
  "name": "AddWebFunctionEndpointOptions",
9778
9778
  "properties": [
@@ -9785,7 +9785,7 @@
9785
9785
  "immutable": true,
9786
9786
  "locationInModule": {
9787
9787
  "filename": "src/web-function-endpoint.ts",
9788
- "line": 109
9788
+ "line": 116
9789
9789
  },
9790
9790
  "name": "authType",
9791
9791
  "type": {
@@ -9803,7 +9803,7 @@
9803
9803
  "immutable": true,
9804
9804
  "locationInModule": {
9805
9805
  "filename": "src/web-function-endpoint.ts",
9806
- "line": 125
9806
+ "line": 132
9807
9807
  },
9808
9808
  "name": "additionalRevisions",
9809
9809
  "optional": true,
@@ -9826,7 +9826,7 @@
9826
9826
  "immutable": true,
9827
9827
  "locationInModule": {
9828
9828
  "filename": "src/web-function-endpoint.ts",
9829
- "line": 117
9829
+ "line": 124
9830
9830
  },
9831
9831
  "name": "revision",
9832
9832
  "optional": true,
@@ -9851,7 +9851,7 @@
9851
9851
  "kind": "interface",
9852
9852
  "locationInModule": {
9853
9853
  "filename": "src/web-function.ts",
9854
- "line": 153
9854
+ "line": 155
9855
9855
  },
9856
9856
  "name": "IWebFunction",
9857
9857
  "properties": [
@@ -9867,7 +9867,7 @@
9867
9867
  "immutable": true,
9868
9868
  "locationInModule": {
9869
9869
  "filename": "src/web-function.ts",
9870
- "line": 166
9870
+ "line": 168
9871
9871
  },
9872
9872
  "name": "webFunctionArn",
9873
9873
  "type": {
@@ -9886,7 +9886,7 @@
9886
9886
  "immutable": true,
9887
9887
  "locationInModule": {
9888
9888
  "filename": "src/web-function.ts",
9889
- "line": 159
9889
+ "line": 161
9890
9890
  },
9891
9891
  "name": "webFunctionName",
9892
9892
  "type": {
@@ -10463,7 +10463,7 @@
10463
10463
  },
10464
10464
  "locationInModule": {
10465
10465
  "filename": "src/web-function.ts",
10466
- "line": 221
10466
+ "line": 223
10467
10467
  },
10468
10468
  "parameters": [
10469
10469
  {
@@ -10493,7 +10493,7 @@
10493
10493
  "kind": "class",
10494
10494
  "locationInModule": {
10495
10495
  "filename": "src/web-function.ts",
10496
- "line": 180
10496
+ "line": 182
10497
10497
  },
10498
10498
  "methods": [
10499
10499
  {
@@ -10503,7 +10503,7 @@
10503
10503
  },
10504
10504
  "locationInModule": {
10505
10505
  "filename": "src/web-function.ts",
10506
- "line": 323
10506
+ "line": 325
10507
10507
  },
10508
10508
  "name": "addEndpoint",
10509
10509
  "parameters": [
@@ -10537,7 +10537,7 @@
10537
10537
  },
10538
10538
  "locationInModule": {
10539
10539
  "filename": "src/web-function.ts",
10540
- "line": 331
10540
+ "line": 333
10541
10541
  },
10542
10542
  "name": "addEnvironment",
10543
10543
  "parameters": [
@@ -10567,7 +10567,7 @@
10567
10567
  },
10568
10568
  "locationInModule": {
10569
10569
  "filename": "src/web-function.ts",
10570
- "line": 342
10570
+ "line": 344
10571
10571
  },
10572
10572
  "name": "addToRolePolicy",
10573
10573
  "parameters": [
@@ -10587,7 +10587,7 @@
10587
10587
  },
10588
10588
  "locationInModule": {
10589
10589
  "filename": "src/web-function.ts",
10590
- "line": 350
10590
+ "line": 352
10591
10591
  },
10592
10592
  "name": "grantInvoke",
10593
10593
  "parameters": [
@@ -10603,6 +10603,167 @@
10603
10603
  "fqn": "aws-cdk-lib.aws_iam.Grant"
10604
10604
  }
10605
10605
  }
10606
+ },
10607
+ {
10608
+ "docs": {
10609
+ "default": "- sum over 1 minute, in the home region",
10610
+ "remarks": "For request and error counts, use the endpoint's metrics (`fn.endpoint.metricRequests()`).\n\nMetrics are published in the region that served the request: pass `region` for another serving region.\nAn alarm can only use metrics from its own stack's region.",
10611
+ "stability": "experimental",
10612
+ "summary": "A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints."
10613
+ },
10614
+ "locationInModule": {
10615
+ "filename": "src/web-function.ts",
10616
+ "line": 365
10617
+ },
10618
+ "name": "metric",
10619
+ "parameters": [
10620
+ {
10621
+ "name": "metricName",
10622
+ "type": {
10623
+ "primitive": "string"
10624
+ }
10625
+ },
10626
+ {
10627
+ "name": "props",
10628
+ "optional": true,
10629
+ "type": {
10630
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10631
+ }
10632
+ }
10633
+ ],
10634
+ "returns": {
10635
+ "type": {
10636
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10637
+ }
10638
+ }
10639
+ },
10640
+ {
10641
+ "docs": {
10642
+ "stability": "experimental",
10643
+ "summary": "Time the execution environments were active (`EnvironmentActiveTime`)."
10644
+ },
10645
+ "locationInModule": {
10646
+ "filename": "src/web-function.ts",
10647
+ "line": 377
10648
+ },
10649
+ "name": "metricActiveTime",
10650
+ "parameters": [
10651
+ {
10652
+ "name": "props",
10653
+ "optional": true,
10654
+ "type": {
10655
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10656
+ }
10657
+ }
10658
+ ],
10659
+ "returns": {
10660
+ "type": {
10661
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10662
+ }
10663
+ }
10664
+ },
10665
+ {
10666
+ "docs": {
10667
+ "default": "- maximum over 1 minute",
10668
+ "stability": "experimental",
10669
+ "summary": "Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`."
10670
+ },
10671
+ "locationInModule": {
10672
+ "filename": "src/web-function.ts",
10673
+ "line": 392
10674
+ },
10675
+ "name": "metricConcurrentRequests",
10676
+ "parameters": [
10677
+ {
10678
+ "name": "props",
10679
+ "optional": true,
10680
+ "type": {
10681
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10682
+ }
10683
+ }
10684
+ ],
10685
+ "returns": {
10686
+ "type": {
10687
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10688
+ }
10689
+ }
10690
+ },
10691
+ {
10692
+ "docs": {
10693
+ "stability": "experimental",
10694
+ "summary": "CPU time the execution environments used (`EnvironmentCPUTime`)."
10695
+ },
10696
+ "locationInModule": {
10697
+ "filename": "src/web-function.ts",
10698
+ "line": 382
10699
+ },
10700
+ "name": "metricCpuTime",
10701
+ "parameters": [
10702
+ {
10703
+ "name": "props",
10704
+ "optional": true,
10705
+ "type": {
10706
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10707
+ }
10708
+ }
10709
+ ],
10710
+ "returns": {
10711
+ "type": {
10712
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10713
+ }
10714
+ }
10715
+ },
10716
+ {
10717
+ "docs": {
10718
+ "default": "- maximum over 1 minute",
10719
+ "remarks": "each environment has 2 GB.",
10720
+ "stability": "experimental",
10721
+ "summary": "Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`);"
10722
+ },
10723
+ "locationInModule": {
10724
+ "filename": "src/web-function.ts",
10725
+ "line": 401
10726
+ },
10727
+ "name": "metricMaxMemoryUsage",
10728
+ "parameters": [
10729
+ {
10730
+ "name": "props",
10731
+ "optional": true,
10732
+ "type": {
10733
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10734
+ }
10735
+ }
10736
+ ],
10737
+ "returns": {
10738
+ "type": {
10739
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10740
+ }
10741
+ }
10742
+ },
10743
+ {
10744
+ "docs": {
10745
+ "stability": "experimental",
10746
+ "summary": "Bytes sent in responses (`ResponseBytes`)."
10747
+ },
10748
+ "locationInModule": {
10749
+ "filename": "src/web-function.ts",
10750
+ "line": 406
10751
+ },
10752
+ "name": "metricResponseBytes",
10753
+ "parameters": [
10754
+ {
10755
+ "name": "props",
10756
+ "optional": true,
10757
+ "type": {
10758
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10759
+ }
10760
+ }
10761
+ ],
10762
+ "returns": {
10763
+ "type": {
10764
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10765
+ }
10766
+ }
10606
10767
  }
10607
10768
  ],
10608
10769
  "name": "WebFunction",
@@ -10615,7 +10776,7 @@
10615
10776
  "immutable": true,
10616
10777
  "locationInModule": {
10617
10778
  "filename": "src/web-function.ts",
10618
- "line": 188
10779
+ "line": 190
10619
10780
  },
10620
10781
  "name": "currentRevision",
10621
10782
  "type": {
@@ -10631,7 +10792,7 @@
10631
10792
  "immutable": true,
10632
10793
  "locationInModule": {
10633
10794
  "filename": "src/web-function.ts",
10634
- "line": 191
10795
+ "line": 193
10635
10796
  },
10636
10797
  "name": "endpoint",
10637
10798
  "type": {
@@ -10646,7 +10807,7 @@
10646
10807
  "immutable": true,
10647
10808
  "locationInModule": {
10648
10809
  "filename": "src/web-function.ts",
10649
- "line": 200
10810
+ "line": 202
10650
10811
  },
10651
10812
  "name": "grantPrincipal",
10652
10813
  "overrides": "aws-cdk-lib.aws_iam.IGrantable",
@@ -10662,7 +10823,7 @@
10662
10823
  "immutable": true,
10663
10824
  "locationInModule": {
10664
10825
  "filename": "src/web-function.ts",
10665
- "line": 194
10826
+ "line": 196
10666
10827
  },
10667
10828
  "name": "grants",
10668
10829
  "type": {
@@ -10678,7 +10839,7 @@
10678
10839
  "immutable": true,
10679
10840
  "locationInModule": {
10680
10841
  "filename": "src/web-function.ts",
10681
- "line": 206
10842
+ "line": 208
10682
10843
  },
10683
10844
  "name": "logGroup",
10684
10845
  "type": {
@@ -10694,7 +10855,7 @@
10694
10855
  "immutable": true,
10695
10856
  "locationInModule": {
10696
10857
  "filename": "src/web-function.ts",
10697
- "line": 185
10858
+ "line": 187
10698
10859
  },
10699
10860
  "name": "revisionId",
10700
10861
  "type": {
@@ -10709,7 +10870,7 @@
10709
10870
  "immutable": true,
10710
10871
  "locationInModule": {
10711
10872
  "filename": "src/web-function.ts",
10712
- "line": 197
10873
+ "line": 199
10713
10874
  },
10714
10875
  "name": "role",
10715
10876
  "type": {
@@ -10724,7 +10885,7 @@
10724
10885
  "immutable": true,
10725
10886
  "locationInModule": {
10726
10887
  "filename": "src/web-function.ts",
10727
- "line": 182
10888
+ "line": 184
10728
10889
  },
10729
10890
  "name": "webFunctionArn",
10730
10891
  "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
@@ -10740,7 +10901,7 @@
10740
10901
  "immutable": true,
10741
10902
  "locationInModule": {
10742
10903
  "filename": "src/web-function.ts",
10743
- "line": 181
10904
+ "line": 183
10744
10905
  },
10745
10906
  "name": "webFunctionName",
10746
10907
  "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
@@ -10756,7 +10917,7 @@
10756
10917
  "immutable": true,
10757
10918
  "locationInModule": {
10758
10919
  "filename": "src/web-function.ts",
10759
- "line": 217
10920
+ "line": 219
10760
10921
  },
10761
10922
  "name": "webFunctionRef",
10762
10923
  "overrides": "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef",
@@ -10810,7 +10971,7 @@
10810
10971
  "kind": "interface",
10811
10972
  "locationInModule": {
10812
10973
  "filename": "src/web-function-deployment.ts",
10813
- "line": 12
10974
+ "line": 61
10814
10975
  },
10815
10976
  "name": "WebFunctionCanaryDeploymentOptions",
10816
10977
  "properties": [
@@ -10824,7 +10985,7 @@
10824
10985
  "immutable": true,
10825
10986
  "locationInModule": {
10826
10987
  "filename": "src/web-function-deployment.ts",
10827
- "line": 22
10988
+ "line": 71
10828
10989
  },
10829
10990
  "name": "bake",
10830
10991
  "type": {
@@ -10840,7 +11001,7 @@
10840
11001
  "immutable": true,
10841
11002
  "locationInModule": {
10842
11003
  "filename": "src/web-function-deployment.ts",
10843
- "line": 16
11004
+ "line": 65
10844
11005
  },
10845
11006
  "name": "percent",
10846
11007
  "type": {
@@ -10858,7 +11019,7 @@
10858
11019
  "immutable": true,
10859
11020
  "locationInModule": {
10860
11021
  "filename": "src/web-function-deployment.ts",
10861
- "line": 33
11022
+ "line": 82
10862
11023
  },
10863
11024
  "name": "alarms",
10864
11025
  "optional": true,
@@ -10870,6 +11031,25 @@
10870
11031
  "kind": "array"
10871
11032
  }
10872
11033
  }
11034
+ },
11035
+ {
11036
+ "abstract": true,
11037
+ "docs": {
11038
+ "default": "- no endpoint alarms",
11039
+ "remarks": "They stop the deployment like `alarms` (both can be used together).",
11040
+ "stability": "experimental",
11041
+ "summary": "Alarms on the endpoint's own error rates, created by the endpoint in every region it serves from."
11042
+ },
11043
+ "immutable": true,
11044
+ "locationInModule": {
11045
+ "filename": "src/web-function-deployment.ts",
11046
+ "line": 90
11047
+ },
11048
+ "name": "rollbackOn",
11049
+ "optional": true,
11050
+ "type": {
11051
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions"
11052
+ }
10873
11053
  }
10874
11054
  ],
10875
11055
  "symbolId": "src/web-function-deployment:WebFunctionCanaryDeploymentOptions"
@@ -10884,7 +11064,7 @@
10884
11064
  "kind": "class",
10885
11065
  "locationInModule": {
10886
11066
  "filename": "src/web-function-deployment.ts",
10887
- "line": 65
11067
+ "line": 130
10888
11068
  },
10889
11069
  "methods": [
10890
11070
  {
@@ -10894,7 +11074,7 @@
10894
11074
  },
10895
11075
  "locationInModule": {
10896
11076
  "filename": "src/web-function-deployment.ts",
10897
- "line": 69
11077
+ "line": 134
10898
11078
  },
10899
11079
  "name": "allAtOnce",
10900
11080
  "returns": {
@@ -10911,7 +11091,7 @@
10911
11091
  },
10912
11092
  "locationInModule": {
10913
11093
  "filename": "src/web-function-deployment.ts",
10914
- "line": 76
11094
+ "line": 141
10915
11095
  },
10916
11096
  "name": "canary",
10917
11097
  "parameters": [
@@ -10936,7 +11116,7 @@
10936
11116
  },
10937
11117
  "locationInModule": {
10938
11118
  "filename": "src/web-function-deployment.ts",
10939
- "line": 85
11119
+ "line": 150
10940
11120
  },
10941
11121
  "name": "linear",
10942
11122
  "parameters": [
@@ -10970,7 +11150,7 @@
10970
11150
  "kind": "class",
10971
11151
  "locationInModule": {
10972
11152
  "filename": "src/web-function-endpoint.ts",
10973
- "line": 150
11153
+ "line": 157
10974
11154
  },
10975
11155
  "methods": [
10976
11156
  {
@@ -10981,7 +11161,7 @@
10981
11161
  },
10982
11162
  "locationInModule": {
10983
11163
  "filename": "src/web-function-endpoint.ts",
10984
- "line": 328
11164
+ "line": 420
10985
11165
  },
10986
11166
  "name": "grantInvoke",
10987
11167
  "parameters": [
@@ -10998,6 +11178,245 @@
10998
11178
  }
10999
11179
  }
11000
11180
  },
11181
+ {
11182
+ "docs": {
11183
+ "default": "- sum over 1 minute, in the home region",
11184
+ "remarks": "Metrics are published in the region that served the request: pass `region` for one of the endpoint's\nother regions. An alarm can only use metrics from its own stack's region.",
11185
+ "stability": "experimental",
11186
+ "summary": "A metric of this endpoint in `AWS/Lambda/Web` (dimensions `FunctionName` and `EndpointName`)."
11187
+ },
11188
+ "locationInModule": {
11189
+ "filename": "src/web-function-endpoint.ts",
11190
+ "line": 355
11191
+ },
11192
+ "name": "metric",
11193
+ "parameters": [
11194
+ {
11195
+ "name": "metricName",
11196
+ "type": {
11197
+ "primitive": "string"
11198
+ }
11199
+ },
11200
+ {
11201
+ "name": "props",
11202
+ "optional": true,
11203
+ "type": {
11204
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11205
+ }
11206
+ }
11207
+ ],
11208
+ "returns": {
11209
+ "type": {
11210
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11211
+ }
11212
+ }
11213
+ },
11214
+ {
11215
+ "docs": {
11216
+ "default": "- maximum over 1 minute, in the home region",
11217
+ "stability": "experimental",
11218
+ "summary": "Execution environments serving the endpoint (`EndpointActiveEnvironments`), to compare with `maxEnvironments`."
11219
+ },
11220
+ "locationInModule": {
11221
+ "filename": "src/web-function-endpoint.ts",
11222
+ "line": 402
11223
+ },
11224
+ "name": "metricActiveEnvironments",
11225
+ "parameters": [
11226
+ {
11227
+ "name": "props",
11228
+ "optional": true,
11229
+ "type": {
11230
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11231
+ }
11232
+ }
11233
+ ],
11234
+ "returns": {
11235
+ "type": {
11236
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11237
+ }
11238
+ }
11239
+ },
11240
+ {
11241
+ "docs": {
11242
+ "remarks": "periods with no 4XX count as 0).",
11243
+ "stability": "experimental",
11244
+ "summary": "The percentage of requests answered with a 4XX status (math expression;"
11245
+ },
11246
+ "locationInModule": {
11247
+ "filename": "src/web-function-endpoint.ts",
11248
+ "line": 388
11249
+ },
11250
+ "name": "metricClientErrorRate",
11251
+ "parameters": [
11252
+ {
11253
+ "name": "props",
11254
+ "optional": true,
11255
+ "type": {
11256
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11257
+ }
11258
+ }
11259
+ ],
11260
+ "returns": {
11261
+ "type": {
11262
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MathExpression"
11263
+ }
11264
+ }
11265
+ },
11266
+ {
11267
+ "docs": {
11268
+ "remarks": "The metric only exists once it's non-zero, so alarms should treat missing data as not breaching.",
11269
+ "stability": "experimental",
11270
+ "summary": "Requests answered with a 4XX status (`HTTPResponseStatusClass4XX`), including 429s from `rateLimit` and `maxEnvironments`."
11271
+ },
11272
+ "locationInModule": {
11273
+ "filename": "src/web-function-endpoint.ts",
11274
+ "line": 375
11275
+ },
11276
+ "name": "metricClientErrors",
11277
+ "parameters": [
11278
+ {
11279
+ "name": "props",
11280
+ "optional": true,
11281
+ "type": {
11282
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11283
+ }
11284
+ }
11285
+ ],
11286
+ "returns": {
11287
+ "type": {
11288
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11289
+ }
11290
+ }
11291
+ },
11292
+ {
11293
+ "docs": {
11294
+ "stability": "experimental",
11295
+ "summary": "Requests rejected with 429 because the endpoint reached `maxEnvironments` (`EndpointActiveEnvironmentThrottles`)."
11296
+ },
11297
+ "locationInModule": {
11298
+ "filename": "src/web-function-endpoint.ts",
11299
+ "line": 412
11300
+ },
11301
+ "name": "metricEnvironmentThrottles",
11302
+ "parameters": [
11303
+ {
11304
+ "name": "props",
11305
+ "optional": true,
11306
+ "type": {
11307
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11308
+ }
11309
+ }
11310
+ ],
11311
+ "returns": {
11312
+ "type": {
11313
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11314
+ }
11315
+ }
11316
+ },
11317
+ {
11318
+ "docs": {
11319
+ "remarks": "There's no separate count of successful (2XX) responses.",
11320
+ "stability": "experimental",
11321
+ "summary": "Requests the endpoint served (`ExecutedRequests`)."
11322
+ },
11323
+ "locationInModule": {
11324
+ "filename": "src/web-function-endpoint.ts",
11325
+ "line": 367
11326
+ },
11327
+ "name": "metricRequests",
11328
+ "parameters": [
11329
+ {
11330
+ "name": "props",
11331
+ "optional": true,
11332
+ "type": {
11333
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11334
+ }
11335
+ }
11336
+ ],
11337
+ "returns": {
11338
+ "type": {
11339
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11340
+ }
11341
+ }
11342
+ },
11343
+ {
11344
+ "docs": {
11345
+ "stability": "experimental",
11346
+ "summary": "Requests rejected with 429 because the endpoint reached its `rateLimit` (`EndpointRequestThrottles`)."
11347
+ },
11348
+ "locationInModule": {
11349
+ "filename": "src/web-function-endpoint.ts",
11350
+ "line": 407
11351
+ },
11352
+ "name": "metricRequestThrottles",
11353
+ "parameters": [
11354
+ {
11355
+ "name": "props",
11356
+ "optional": true,
11357
+ "type": {
11358
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11359
+ }
11360
+ }
11361
+ ],
11362
+ "returns": {
11363
+ "type": {
11364
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11365
+ }
11366
+ }
11367
+ },
11368
+ {
11369
+ "docs": {
11370
+ "remarks": "periods with no 5XX count as 0).",
11371
+ "stability": "experimental",
11372
+ "summary": "The percentage of requests answered with a 5XX status (math expression;"
11373
+ },
11374
+ "locationInModule": {
11375
+ "filename": "src/web-function-endpoint.ts",
11376
+ "line": 393
11377
+ },
11378
+ "name": "metricServerErrorRate",
11379
+ "parameters": [
11380
+ {
11381
+ "name": "props",
11382
+ "optional": true,
11383
+ "type": {
11384
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11385
+ }
11386
+ }
11387
+ ],
11388
+ "returns": {
11389
+ "type": {
11390
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MathExpression"
11391
+ }
11392
+ }
11393
+ },
11394
+ {
11395
+ "docs": {
11396
+ "remarks": "Includes the platform's 503s while the endpoint\nscales up for a sudden burst, not only your application's errors. The metric only exists once it's non-zero.",
11397
+ "stability": "experimental",
11398
+ "summary": "Requests answered with a 5XX status (`HTTPResponseStatusClass5XX`)."
11399
+ },
11400
+ "locationInModule": {
11401
+ "filename": "src/web-function-endpoint.ts",
11402
+ "line": 383
11403
+ },
11404
+ "name": "metricServerErrors",
11405
+ "parameters": [
11406
+ {
11407
+ "name": "props",
11408
+ "optional": true,
11409
+ "type": {
11410
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11411
+ }
11412
+ }
11413
+ ],
11414
+ "returns": {
11415
+ "type": {
11416
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11417
+ }
11418
+ }
11419
+ },
11001
11420
  {
11002
11421
  "docs": {
11003
11422
  "remarks": "Only for `PER_REGION` endpoints.",
@@ -11006,7 +11425,7 @@
11006
11425
  },
11007
11426
  "locationInModule": {
11008
11427
  "filename": "src/web-function-endpoint.ts",
11009
- "line": 275
11428
+ "line": 298
11010
11429
  },
11011
11430
  "name": "regionalUrl",
11012
11431
  "parameters": [
@@ -11034,7 +11453,7 @@
11034
11453
  },
11035
11454
  "locationInModule": {
11036
11455
  "filename": "src/web-function-endpoint.ts",
11037
- "line": 303
11456
+ "line": 326
11038
11457
  },
11039
11458
  "name": "routeTraffic",
11040
11459
  "parameters": [
@@ -11069,7 +11488,7 @@
11069
11488
  "immutable": true,
11070
11489
  "locationInModule": {
11071
11490
  "filename": "src/web-function-endpoint.ts",
11072
- "line": 170
11491
+ "line": 177
11073
11492
  },
11074
11493
  "name": "authType",
11075
11494
  "type": {
@@ -11084,7 +11503,7 @@
11084
11503
  "immutable": true,
11085
11504
  "locationInModule": {
11086
11505
  "filename": "src/web-function-endpoint.ts",
11087
- "line": 178
11506
+ "line": 185
11088
11507
  },
11089
11508
  "name": "domainName",
11090
11509
  "type": {
@@ -11099,7 +11518,7 @@
11099
11518
  "immutable": true,
11100
11519
  "locationInModule": {
11101
11520
  "filename": "src/web-function-endpoint.ts",
11102
- "line": 164
11521
+ "line": 171
11103
11522
  },
11104
11523
  "name": "endpointArn",
11105
11524
  "type": {
@@ -11114,7 +11533,7 @@
11114
11533
  "immutable": true,
11115
11534
  "locationInModule": {
11116
11535
  "filename": "src/web-function-endpoint.ts",
11117
- "line": 161
11536
+ "line": 168
11118
11537
  },
11119
11538
  "name": "endpointName",
11120
11539
  "type": {
@@ -11129,7 +11548,7 @@
11129
11548
  "immutable": true,
11130
11549
  "locationInModule": {
11131
11550
  "filename": "src/web-function-endpoint.ts",
11132
- "line": 167
11551
+ "line": 174
11133
11552
  },
11134
11553
  "name": "endpointType",
11135
11554
  "type": {
@@ -11144,7 +11563,7 @@
11144
11563
  "immutable": true,
11145
11564
  "locationInModule": {
11146
11565
  "filename": "src/web-function-endpoint.ts",
11147
- "line": 186
11566
+ "line": 193
11148
11567
  },
11149
11568
  "name": "grants",
11150
11569
  "type": {
@@ -11159,7 +11578,7 @@
11159
11578
  "immutable": true,
11160
11579
  "locationInModule": {
11161
11580
  "filename": "src/web-function-endpoint.ts",
11162
- "line": 173
11581
+ "line": 180
11163
11582
  },
11164
11583
  "name": "regions",
11165
11584
  "type": {
@@ -11171,6 +11590,27 @@
11171
11590
  }
11172
11591
  }
11173
11592
  },
11593
+ {
11594
+ "docs": {
11595
+ "remarks": "Empty without `rollbackOn`.",
11596
+ "stability": "experimental",
11597
+ "summary": "The alarms this endpoint created for its deployment's `rollbackOn`, one per threshold in every region it serves from (the home region's first)."
11598
+ },
11599
+ "immutable": true,
11600
+ "locationInModule": {
11601
+ "filename": "src/web-function-endpoint.ts",
11602
+ "line": 199
11603
+ },
11604
+ "name": "rollbackAlarms",
11605
+ "type": {
11606
+ "collection": {
11607
+ "elementtype": {
11608
+ "fqn": "aws-cdk-lib.aws_cloudwatch.IAlarm"
11609
+ },
11610
+ "kind": "array"
11611
+ }
11612
+ }
11613
+ },
11174
11614
  {
11175
11615
  "docs": {
11176
11616
  "stability": "experimental",
@@ -11179,7 +11619,7 @@
11179
11619
  "immutable": true,
11180
11620
  "locationInModule": {
11181
11621
  "filename": "src/web-function-endpoint.ts",
11182
- "line": 183
11622
+ "line": 190
11183
11623
  },
11184
11624
  "name": "url",
11185
11625
  "type": {
@@ -11200,7 +11640,7 @@
11200
11640
  "kind": "interface",
11201
11641
  "locationInModule": {
11202
11642
  "filename": "src/web-function-endpoint.ts",
11203
- "line": 32
11643
+ "line": 39
11204
11644
  },
11205
11645
  "name": "WebFunctionEndpointOptions",
11206
11646
  "properties": [
@@ -11215,7 +11655,7 @@
11215
11655
  "immutable": true,
11216
11656
  "locationInModule": {
11217
11657
  "filename": "src/web-function-endpoint.ts",
11218
- "line": 99
11658
+ "line": 106
11219
11659
  },
11220
11660
  "name": "deployment",
11221
11661
  "optional": true,
@@ -11233,7 +11673,7 @@
11233
11673
  "immutable": true,
11234
11674
  "locationInModule": {
11235
11675
  "filename": "src/web-function-endpoint.ts",
11236
- "line": 68
11676
+ "line": 75
11237
11677
  },
11238
11678
  "name": "description",
11239
11679
  "optional": true,
@@ -11252,7 +11692,7 @@
11252
11692
  "immutable": true,
11253
11693
  "locationInModule": {
11254
11694
  "filename": "src/web-function-endpoint.ts",
11255
- "line": 61
11695
+ "line": 68
11256
11696
  },
11257
11697
  "name": "endpointName",
11258
11698
  "optional": true,
@@ -11270,7 +11710,7 @@
11270
11710
  "immutable": true,
11271
11711
  "locationInModule": {
11272
11712
  "filename": "src/web-function-endpoint.ts",
11273
- "line": 38
11713
+ "line": 45
11274
11714
  },
11275
11715
  "name": "endpointType",
11276
11716
  "optional": true,
@@ -11289,7 +11729,7 @@
11289
11729
  "immutable": true,
11290
11730
  "locationInModule": {
11291
11731
  "filename": "src/web-function-endpoint.ts",
11292
- "line": 88
11732
+ "line": 95
11293
11733
  },
11294
11734
  "name": "maxEnvironments",
11295
11735
  "optional": true,
@@ -11308,7 +11748,7 @@
11308
11748
  "immutable": true,
11309
11749
  "locationInModule": {
11310
11750
  "filename": "src/web-function-endpoint.ts",
11311
- "line": 79
11751
+ "line": 86
11312
11752
  },
11313
11753
  "name": "rateLimit",
11314
11754
  "optional": true,
@@ -11327,7 +11767,7 @@
11327
11767
  "immutable": true,
11328
11768
  "locationInModule": {
11329
11769
  "filename": "src/web-function-endpoint.ts",
11330
- "line": 48
11770
+ "line": 55
11331
11771
  },
11332
11772
  "name": "regions",
11333
11773
  "optional": true,
@@ -11435,7 +11875,7 @@
11435
11875
  "kind": "interface",
11436
11876
  "locationInModule": {
11437
11877
  "filename": "src/web-function-deployment.ts",
11438
- "line": 39
11878
+ "line": 96
11439
11879
  },
11440
11880
  "name": "WebFunctionLinearDeploymentOptions",
11441
11881
  "properties": [
@@ -11448,7 +11888,7 @@
11448
11888
  "immutable": true,
11449
11889
  "locationInModule": {
11450
11890
  "filename": "src/web-function-deployment.ts",
11451
- "line": 48
11891
+ "line": 105
11452
11892
  },
11453
11893
  "name": "interval",
11454
11894
  "type": {
@@ -11464,7 +11904,7 @@
11464
11904
  "immutable": true,
11465
11905
  "locationInModule": {
11466
11906
  "filename": "src/web-function-deployment.ts",
11467
- "line": 43
11907
+ "line": 100
11468
11908
  },
11469
11909
  "name": "percent",
11470
11910
  "type": {
@@ -11482,7 +11922,7 @@
11482
11922
  "immutable": true,
11483
11923
  "locationInModule": {
11484
11924
  "filename": "src/web-function-deployment.ts",
11485
- "line": 59
11925
+ "line": 116
11486
11926
  },
11487
11927
  "name": "alarms",
11488
11928
  "optional": true,
@@ -11494,6 +11934,25 @@
11494
11934
  "kind": "array"
11495
11935
  }
11496
11936
  }
11937
+ },
11938
+ {
11939
+ "abstract": true,
11940
+ "docs": {
11941
+ "default": "- no endpoint alarms",
11942
+ "remarks": "They stop the deployment like `alarms` (both can be used together).",
11943
+ "stability": "experimental",
11944
+ "summary": "Alarms on the endpoint's own error rates, created by the endpoint in every region it serves from."
11945
+ },
11946
+ "immutable": true,
11947
+ "locationInModule": {
11948
+ "filename": "src/web-function-deployment.ts",
11949
+ "line": 124
11950
+ },
11951
+ "name": "rollbackOn",
11952
+ "optional": true,
11953
+ "type": {
11954
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions"
11955
+ }
11497
11956
  }
11498
11957
  ],
11499
11958
  "symbolId": "src/web-function-deployment:WebFunctionLinearDeploymentOptions"
@@ -11509,7 +11968,7 @@
11509
11968
  "kind": "interface",
11510
11969
  "locationInModule": {
11511
11970
  "filename": "src/web-function.ts",
11512
- "line": 21
11971
+ "line": 23
11513
11972
  },
11514
11973
  "name": "WebFunctionOptions",
11515
11974
  "properties": [
@@ -11522,7 +11981,7 @@
11522
11981
  "immutable": true,
11523
11982
  "locationInModule": {
11524
11983
  "filename": "src/web-function.ts",
11525
- "line": 25
11984
+ "line": 27
11526
11985
  },
11527
11986
  "name": "authType",
11528
11987
  "type": {
@@ -11539,7 +11998,7 @@
11539
11998
  "immutable": true,
11540
11999
  "locationInModule": {
11541
12000
  "filename": "src/web-function.ts",
11542
- "line": 114
12001
+ "line": 116
11543
12002
  },
11544
12003
  "name": "applicationLogLevelV2",
11545
12004
  "optional": true,
@@ -11557,7 +12016,7 @@
11557
12016
  "immutable": true,
11558
12017
  "locationInModule": {
11559
12018
  "filename": "src/web-function.ts",
11560
- "line": 60
12019
+ "line": 62
11561
12020
  },
11562
12021
  "name": "description",
11563
12022
  "optional": true,
@@ -11575,7 +12034,7 @@
11575
12034
  "immutable": true,
11576
12035
  "locationInModule": {
11577
12036
  "filename": "src/web-function.ts",
11578
- "line": 34
12037
+ "line": 36
11579
12038
  },
11580
12039
  "name": "endpoint",
11581
12040
  "optional": true,
@@ -11594,7 +12053,7 @@
11594
12053
  "immutable": true,
11595
12054
  "locationInModule": {
11596
12055
  "filename": "src/web-function.ts",
11597
- "line": 77
12056
+ "line": 79
11598
12057
  },
11599
12058
  "name": "environment",
11600
12059
  "optional": true,
@@ -11618,7 +12077,7 @@
11618
12077
  "immutable": true,
11619
12078
  "locationInModule": {
11620
12079
  "filename": "src/web-function.ts",
11621
- "line": 107
12080
+ "line": 109
11622
12081
  },
11623
12082
  "name": "logRemovalPolicy",
11624
12083
  "optional": true,
@@ -11636,7 +12095,7 @@
11636
12095
  "immutable": true,
11637
12096
  "locationInModule": {
11638
12097
  "filename": "src/web-function.ts",
11639
- "line": 99
12098
+ "line": 101
11640
12099
  },
11641
12100
  "name": "logRetention",
11642
12101
  "optional": true,
@@ -11655,7 +12114,7 @@
11655
12114
  "immutable": true,
11656
12115
  "locationInModule": {
11657
12116
  "filename": "src/web-function.ts",
11658
- "line": 92
12117
+ "line": 94
11659
12118
  },
11660
12119
  "name": "maxConcurrencyPerEnvironment",
11661
12120
  "optional": true,
@@ -11674,7 +12133,7 @@
11674
12133
  "immutable": true,
11675
12134
  "locationInModule": {
11676
12135
  "filename": "src/web-function.ts",
11677
- "line": 46
12136
+ "line": 48
11678
12137
  },
11679
12138
  "name": "revisionRetention",
11680
12139
  "optional": true,
@@ -11693,7 +12152,7 @@
11693
12152
  "immutable": true,
11694
12153
  "locationInModule": {
11695
12154
  "filename": "src/web-function.ts",
11696
- "line": 70
12155
+ "line": 72
11697
12156
  },
11698
12157
  "name": "role",
11699
12158
  "optional": true,
@@ -11711,7 +12170,7 @@
11711
12170
  "immutable": true,
11712
12171
  "locationInModule": {
11713
12172
  "filename": "src/web-function.ts",
11714
- "line": 121
12173
+ "line": 123
11715
12174
  },
11716
12175
  "name": "systemLogLevelV2",
11717
12176
  "optional": true,
@@ -11729,7 +12188,7 @@
11729
12188
  "immutable": true,
11730
12189
  "locationInModule": {
11731
12190
  "filename": "src/web-function.ts",
11732
- "line": 84
12191
+ "line": 86
11733
12192
  },
11734
12193
  "name": "timeout",
11735
12194
  "optional": true,
@@ -11748,7 +12207,7 @@
11748
12207
  "immutable": true,
11749
12208
  "locationInModule": {
11750
12209
  "filename": "src/web-function.ts",
11751
- "line": 53
12210
+ "line": 55
11752
12211
  },
11753
12212
  "name": "webFunctionName",
11754
12213
  "optional": true,
@@ -11773,7 +12232,7 @@
11773
12232
  "kind": "interface",
11774
12233
  "locationInModule": {
11775
12234
  "filename": "src/web-function.ts",
11776
- "line": 127
12235
+ "line": 129
11777
12236
  },
11778
12237
  "name": "WebFunctionProps",
11779
12238
  "properties": [
@@ -11787,7 +12246,7 @@
11787
12246
  "immutable": true,
11788
12247
  "locationInModule": {
11789
12248
  "filename": "src/web-function.ts",
11790
- "line": 139
12249
+ "line": 141
11791
12250
  },
11792
12251
  "name": "code",
11793
12252
  "type": {
@@ -11803,7 +12262,7 @@
11803
12262
  "immutable": true,
11804
12263
  "locationInModule": {
11805
12264
  "filename": "src/web-function.ts",
11806
- "line": 131
12265
+ "line": 133
11807
12266
  },
11808
12267
  "name": "runtime",
11809
12268
  "type": {
@@ -11820,7 +12279,7 @@
11820
12279
  "immutable": true,
11821
12280
  "locationInModule": {
11822
12281
  "filename": "src/web-function.ts",
11823
- "line": 146
12282
+ "line": 148
11824
12283
  },
11825
12284
  "name": "entrypoint",
11826
12285
  "optional": true,
@@ -12001,7 +12460,7 @@
12001
12460
  "kind": "interface",
12002
12461
  "locationInModule": {
12003
12462
  "filename": "src/web-function-endpoint.ts",
12004
- "line": 18
12463
+ "line": 25
12005
12464
  },
12006
12465
  "name": "WebFunctionRevisionWeight",
12007
12466
  "properties": [
@@ -12014,7 +12473,7 @@
12014
12473
  "immutable": true,
12015
12474
  "locationInModule": {
12016
12475
  "filename": "src/web-function-endpoint.ts",
12017
- "line": 20
12476
+ "line": 27
12018
12477
  },
12019
12478
  "name": "revision",
12020
12479
  "type": {
@@ -12030,7 +12489,7 @@
12030
12489
  "immutable": true,
12031
12490
  "locationInModule": {
12032
12491
  "filename": "src/web-function-endpoint.ts",
12033
- "line": 26
12492
+ "line": 33
12034
12493
  },
12035
12494
  "name": "weight",
12036
12495
  "type": {
@@ -12039,8 +12498,119 @@
12039
12498
  }
12040
12499
  ],
12041
12500
  "symbolId": "src/web-function-endpoint:WebFunctionRevisionWeight"
12501
+ },
12502
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions": {
12503
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
12504
+ "datatype": true,
12505
+ "docs": {
12506
+ "remarks": "The endpoint creates one alarm per threshold in every region it serves from (metrics are published\nin the region that served the request, and an alarm can only watch metrics in its own region).\nLambda Web Function metrics have no revision dimension, so the alarms watch the whole endpoint: while\nthe new revision gets 10% of the traffic, its errors are about a tenth of the endpoint's.",
12507
+ "stability": "experimental",
12508
+ "summary": "Alarms an endpoint creates on its own metrics to stop a canary or linear deployment."
12509
+ },
12510
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions",
12511
+ "kind": "interface",
12512
+ "locationInModule": {
12513
+ "filename": "src/web-function-deployment.ts",
12514
+ "line": 18
12515
+ },
12516
+ "name": "WebFunctionRollbackOptions",
12517
+ "properties": [
12518
+ {
12519
+ "abstract": true,
12520
+ "docs": {
12521
+ "default": "- no client error alarm",
12522
+ "remarks": "Requests over `rateLimit` or `maxEnvironments` get 429, which counts here.",
12523
+ "stability": "experimental",
12524
+ "summary": "Roll back when more than this percent of the endpoint's requests get a 4XX response (0-100)."
12525
+ },
12526
+ "immutable": true,
12527
+ "locationInModule": {
12528
+ "filename": "src/web-function-deployment.ts",
12529
+ "line": 34
12530
+ },
12531
+ "name": "clientErrorRate",
12532
+ "optional": true,
12533
+ "type": {
12534
+ "primitive": "number"
12535
+ }
12536
+ },
12537
+ {
12538
+ "abstract": true,
12539
+ "docs": {
12540
+ "default": "2",
12541
+ "stability": "experimental",
12542
+ "summary": "How many consecutive periods must breach a threshold before the deployment rolls back."
12543
+ },
12544
+ "immutable": true,
12545
+ "locationInModule": {
12546
+ "filename": "src/web-function-deployment.ts",
12547
+ "line": 55
12548
+ },
12549
+ "name": "evaluationPeriods",
12550
+ "optional": true,
12551
+ "type": {
12552
+ "primitive": "number"
12553
+ }
12554
+ },
12555
+ {
12556
+ "abstract": true,
12557
+ "docs": {
12558
+ "default": "10",
12559
+ "stability": "experimental",
12560
+ "summary": "Periods with fewer requests than this don't count, so one failed request out of two doesn't roll back."
12561
+ },
12562
+ "immutable": true,
12563
+ "locationInModule": {
12564
+ "filename": "src/web-function-deployment.ts",
12565
+ "line": 41
12566
+ },
12567
+ "name": "minimumRequests",
12568
+ "optional": true,
12569
+ "type": {
12570
+ "primitive": "number"
12571
+ }
12572
+ },
12573
+ {
12574
+ "abstract": true,
12575
+ "docs": {
12576
+ "default": "Duration.minutes(1)",
12577
+ "stability": "experimental",
12578
+ "summary": "The period each rate is measured over (at least 1 minute, in whole minutes)."
12579
+ },
12580
+ "immutable": true,
12581
+ "locationInModule": {
12582
+ "filename": "src/web-function-deployment.ts",
12583
+ "line": 48
12584
+ },
12585
+ "name": "period",
12586
+ "optional": true,
12587
+ "type": {
12588
+ "fqn": "aws-cdk-lib.Duration"
12589
+ }
12590
+ },
12591
+ {
12592
+ "abstract": true,
12593
+ "docs": {
12594
+ "default": "- no server error alarm",
12595
+ "remarks": "5XX includes the platform's 503s while an endpoint scales up for a sudden burst, not only your application's errors.",
12596
+ "stability": "experimental",
12597
+ "summary": "Roll back when more than this percent of the endpoint's requests get a 5XX response (0-100)."
12598
+ },
12599
+ "immutable": true,
12600
+ "locationInModule": {
12601
+ "filename": "src/web-function-deployment.ts",
12602
+ "line": 26
12603
+ },
12604
+ "name": "serverErrorRate",
12605
+ "optional": true,
12606
+ "type": {
12607
+ "primitive": "number"
12608
+ }
12609
+ }
12610
+ ],
12611
+ "symbolId": "src/web-function-deployment:WebFunctionRollbackOptions"
12042
12612
  }
12043
12613
  },
12044
- "version": "0.1.2",
12045
- "fingerprint": "klXX+MmGau/7IlYuQHB50VIISLQsvsWWTDfCXLEc9FQ="
12614
+ "version": "0.1.3",
12615
+ "fingerprint": "F4xpSs8RKEtfPPB2ssJBW33WiisXtZt7E1UR0EZcJQs="
12046
12616
  }