From b61a8c516e2494a072cd8cfcd8041600c4bb5ab3 Mon Sep 17 00:00:00 2001 From: Romain Marcadier Date: Wed, 9 Mar 2022 18:09:00 +0100 Subject: [PATCH 01/12] chore: make node-bundle's "build" script behave as others (#19307) The default `projen` build step re-generates the `package.json` file and re-install dependencies, which breaks in case the `align-versions.sh` script was run (as the re-generated `package.json` has version `0.0.0` again). This inserts a hack to reset the `build` script and make it a synonym to the `compile` script. This was breaking the `jsii` integration tests (they try to build, but not test, `aws-cdk`). --- tools/@aws-cdk/node-bundle/.projen/tasks.json | 15 --------------- tools/@aws-cdk/node-bundle/.projenrc.js | 9 +++++++++ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/tools/@aws-cdk/node-bundle/.projen/tasks.json b/tools/@aws-cdk/node-bundle/.projen/tasks.json index 1c852b3dac750..0dda07fc72fa9 100644 --- a/tools/@aws-cdk/node-bundle/.projen/tasks.json +++ b/tools/@aws-cdk/node-bundle/.projen/tasks.json @@ -4,23 +4,8 @@ "name": "build", "description": "Full release build", "steps": [ - { - "spawn": "default" - }, - { - "spawn": "pre-compile" - }, { "spawn": "compile" - }, - { - "spawn": "post-compile" - }, - { - "spawn": "test" - }, - { - "spawn": "package" } ] }, diff --git a/tools/@aws-cdk/node-bundle/.projenrc.js b/tools/@aws-cdk/node-bundle/.projenrc.js index f81b9b2144c08..2f601e9dbd3bd 100644 --- a/tools/@aws-cdk/node-bundle/.projenrc.js +++ b/tools/@aws-cdk/node-bundle/.projenrc.js @@ -24,6 +24,15 @@ const project = new typescript.TypeScriptProject({ project.gitignore.exclude('.vscode/'); +// Ensure `npm run build` behaves the same as in other packages. Failure to do +// so results in re-generating the `package.json` with `version: 0.0.0` which +// undoes the work of `align-versions.sh` and breaks jsii integration tests. +// This can be removed if the `@aws-cdk/node-bundle` is moved out of this mono +// repository. +project.buildTask._locked = false; // <-- !HAXX! there is (understandably) not API to unlock... +project.buildTask.reset(); +project.buildTask.prependSpawn(project.compileTask); + // needed for CLI tests to run project.testTask.prependSpawn(project.compileTask); From 1c8bd65059b30df79c152dd664185b28c44e0824 Mon Sep 17 00:00:00 2001 From: Cory Hall <43035978+corymhall@users.noreply.github.com> Date: Wed, 9 Mar 2022 13:46:04 -0500 Subject: [PATCH 02/12] docs(aws-cognito): fix link to aws-cognito-identitypool-alpha module (#19306) fixes #19291 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-cognito/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-cognito/README.md b/packages/@aws-cdk/aws-cognito/README.md index 96629cf13decd..c7348ad5e9b0c 100644 --- a/packages/@aws-cdk/aws-cognito/README.md +++ b/packages/@aws-cdk/aws-cognito/README.md @@ -31,7 +31,7 @@ The two main components of Amazon Cognito are [user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html) and [identity pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html). User pools are user directories that provide sign-up and sign-in options for your app users. Identity pools enable you to grant your users access to -other AWS services. Identity Pool L2 Constructs can be found [here](../aws-cognito-identitypool). +other AWS services. Identity Pool L2 Constructs can be found [here](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cognito-identitypool-alpha-readme.html). This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. From 289a79467d9974ee3582c9e30843b0eb9e90b467 Mon Sep 17 00:00:00 2001 From: Nicola Sacco Date: Wed, 9 Mar 2022 21:39:11 +0100 Subject: [PATCH 03/12] fix(aws-route53-targets): add support for custom cname_prefix urls in elastic beanstalk environment endpoint target (#18804) This PR fixes the extraction of the region name from a Elastic Beanstalk Environment URL generated with a custom CNAME_PREFIX. The code is backward compatible with the regular URL # Motivation ElasticBeanstalkEnvironmentEndpointTarget is used to create an alias target for ElasticBeanstalk Environments that are already created and published for a certain region. When creating an ElasticBeanstalk Environment is possible to configure a `cname_prefix` in order to have a "deterministic" url for the generated environment. Normally the generated url looks like `mybeanstalkenvironment.xyz.eu-west-1.elasticbeanstalk.com`, however when the `cname_prefix` is specified the url loses the randomly generated hash and looks like `mycnameprefix.eu-west-1.elasticbeanstalk.com`. In the custom `cname_prefix` scenario the `ElasticBeanstalkEnvironmentEndpointTarget` class fails with the following error: ``` jsii.errors.JSIIError: Elastic Beanstalk environment target is not supported for the "elasticbeanstalk" region. ``` I mentioned this problem also [here](https://github.com/aws/aws-cdk/issues/17992#issuecomment-1026646049), sorry for the double comment. This PR does not fix the original problem of that issue thread. # How to reproduce Consider this scenario: ``` # app1.py # EB Enviroment enviroment = elasticbeanstalk.CfnEnvironment(self, 'Enviroment', environment_name='MySampleEnviroment', application_name=application.application_name or application_name, solution_stack_name=SOLUTION_STACK_NAME, option_settings=self.get_option_setting_properties(), version_label=app_version_props.ref, cname_prefix='myapp' ) ``` This generates an elastic beanstalk environment with url `myapp.eu-west-1.elasticbeanstalk.com` (supposing one it's deploying in eu-west-1). Then a following cdk app tries to create a DNS record for it ``` # app2.py route53.ARecord(self, f'{construct_label}AliasRecord', target=route53.RecordTarget.from_alias( targets.ElasticBeanstalkEnvironmentEndpointTarget( 'myapp.eu-west-1.elasticbeanstalk.com', ), ), zone=domain_configuration.hosted_zone, ) ``` At this point the command cdk diff returns the following error: ``` jsii.errors.JSIIError: Elastic Beanstalk environment target is not supported for the "elasticbeanstalk" region. ``` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../elastic-beanstalk-environment-target.ts | 5 ++++- ...astic-beanstalk-environment-target.test.ts | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts b/packages/@aws-cdk/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts index ef48c2845c233..255114b773854 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts +++ b/packages/@aws-cdk/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts @@ -5,6 +5,7 @@ import { RegionInfo } from '@aws-cdk/region-info'; /** * Use an Elastic Beanstalk environment URL as an alias record target. * E.g. mysampleenvironment.xyz.us-east-1.elasticbeanstalk.com + * or mycustomcnameprefix.us-east-1.elasticbeanstalk.com * * Only supports Elastic Beanstalk environments created after 2016 that have a regional endpoint. */ @@ -18,7 +19,9 @@ export class ElasticBeanstalkEnvironmentEndpointTarget implements route53.IAlias } const dnsName = this.environmentEndpoint; - const region = cdk.Fn.select(2, cdk.Fn.split('.', dnsName)); + const subDomains = cdk.Fn.split('.', dnsName); + const regionSubdomainIndex = subDomains.length - 3; + const region = cdk.Fn.select(regionSubdomainIndex, subDomains); const { ebsEnvEndpointHostedZoneId: hostedZoneId } = RegionInfo.get(region); if (!hostedZoneId || !dnsName) { diff --git a/packages/@aws-cdk/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts b/packages/@aws-cdk/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts index 44cadae6e3b9f..a60fd9be58d5b 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts +++ b/packages/@aws-cdk/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts @@ -23,3 +23,25 @@ test('use EBS environment as record target', () => { }, }); }); + + +test('support 4-levels subdomain URLs for EBS environments', () => { + // GIVEN + const stack = new Stack(); + const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); + + // WHEN + new route53.ARecord(stack, 'Alias', { + zone, + recordName: '_foo', + target: route53.RecordTarget.fromAlias(new targets.ElasticBeanstalkEnvironmentEndpointTarget('mycustomcnameprefix.us-east-1.elasticbeanstalk.com')), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + AliasTarget: { + DNSName: 'mycustomcnameprefix.us-east-1.elasticbeanstalk.com', + HostedZoneId: 'Z117KPS5GTRQ2G', + }, + }); +}); From d9e60dad8db34a5a6db3e5889823e90856686e84 Mon Sep 17 00:00:00 2001 From: AWS CDK Team Date: Wed, 9 Mar 2022 21:59:51 +0000 Subject: [PATCH 04/12] chore(release): 1.148.0 --- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++++ version.v1.json | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 435ac9555c58a..e03b5b71a45fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,40 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.148.0](https://github.com/aws/aws-cdk/compare/v1.147.0...v1.148.0) (2022-03-09) + + +### Features + +* **aws-apigateway:** add ability to include authorizer context in apigw sfn integration ([#18892](https://github.com/aws/aws-cdk/issues/18892)) ([e7c0c75](https://github.com/aws/aws-cdk/commit/e7c0c75dbc7cf71164673626dc0ab63fb3706223)), closes [#18891](https://github.com/aws/aws-cdk/issues/18891) +* **aws-s3objectlambda:** add L2 construct for S3 Object Lambda ([#15833](https://github.com/aws/aws-cdk/issues/15833)) ([fe9f750](https://github.com/aws/aws-cdk/commit/fe9f750bd9dd9974b9ae6f73c78fcd12ab2edd91)), closes [#13675](https://github.com/aws/aws-cdk/issues/13675) +* **cfnspec:** cloudformation spec v59.0.0 ([#19236](https://github.com/aws/aws-cdk/issues/19236)) ([f46a14d](https://github.com/aws/aws-cdk/commit/f46a14da9bec1aad7096b62666cb80ce42f04b53)) +* **codebuild:** improved support for ARM build images ([#19052](https://github.com/aws/aws-cdk/issues/19052)) ([4eac4de](https://github.com/aws/aws-cdk/commit/4eac4deb98411e921e5a2e6477185207b8588f75)), closes [#18916](https://github.com/aws/aws-cdk/issues/18916) [#9817](https://github.com/aws/aws-cdk/issues/9817) +* **eks:** Service Account names validation ([#19251](https://github.com/aws/aws-cdk/issues/19251)) ([7c3099e](https://github.com/aws/aws-cdk/commit/7c3099e958d7bf0ddb5a7b08afb672a0c652b27d)), closes [#18189](https://github.com/aws/aws-cdk/issues/18189) +* **elasticsearch:** Decouple setting access policies from domain constructor ([#15876](https://github.com/aws/aws-cdk/issues/15876)) ([cefdfd3](https://github.com/aws/aws-cdk/commit/cefdfd384eeac1752567f672452296def68b1206)) +* **iotevents:** support actions ([#18869](https://github.com/aws/aws-cdk/issues/18869)) ([e01654e](https://github.com/aws/aws-cdk/commit/e01654e792708ee283d7a31e1370d0d1ae383171)) +* **iotevents:** support setting Events on input and exit for State ([#19249](https://github.com/aws/aws-cdk/issues/19249)) ([ffa9e0d](https://github.com/aws/aws-cdk/commit/ffa9e0d287d0a86e1e0eb7dc2dec16d9f3e84450)) +* **lambda-nodejs:** support esbuild inject ([#19221](https://github.com/aws/aws-cdk/issues/19221)) ([3432c45](https://github.com/aws/aws-cdk/commit/3432c457fe38a83743d7ce2a5cb6c36a6ec01b8f)), closes [#19133](https://github.com/aws/aws-cdk/issues/19133) +* **s3:** add `s3:ObjectRestore:Delete` to `EventType` for notification ([#19250](https://github.com/aws/aws-cdk/issues/19250)) ([e0f863a](https://github.com/aws/aws-cdk/commit/e0f863a4c56041860e14c75b9aa5a6d35860fae6)), closes [#19223](https://github.com/aws/aws-cdk/issues/19223) +* **servicecatalog:** Service Catalog is now in Developer Preview ([#19204](https://github.com/aws/aws-cdk/issues/19204)) ([6dfc254](https://github.com/aws/aws-cdk/commit/6dfc254e1925597b4ef2ece9c132b1a0e580dd6d)) + + +### Bug Fixes + +* **apigatewayv2-integrations:** in case of multiple routes, only one execute permission is created ([#18716](https://github.com/aws/aws-cdk/issues/18716)) ([1e352ca](https://github.com/aws/aws-cdk/commit/1e352ca2ab458bfe4e1de6cf431166654ce9aa58)) +* **aws-apigateway:** missing comma to make failure response payload valid json ([#19253](https://github.com/aws/aws-cdk/issues/19253)) ([b1fce4f](https://github.com/aws/aws-cdk/commit/b1fce4f1641c90a4b7d1d33139453260b452d5cd)), closes [#19252](https://github.com/aws/aws-cdk/issues/19252) +* **aws-route53-targets:** add support for custom cname_prefix urls in elastic beanstalk environment endpoint target ([#18804](https://github.com/aws/aws-cdk/issues/18804)) ([289a794](https://github.com/aws/aws-cdk/commit/289a79467d9974ee3582c9e30843b0eb9e90b467)) +* **cli:** `watch` logs always end with the 'truncated' message ([#19241](https://github.com/aws/aws-cdk/issues/19241)) ([d3fdfe5](https://github.com/aws/aws-cdk/commit/d3fdfe5264e64cb333795b32edbad36cfaab3dc7)), closes [#18805](https://github.com/aws/aws-cdk/issues/18805) +* **cli:** deprecated stack ids printed at the end of synth ([#19216](https://github.com/aws/aws-cdk/issues/19216)) ([7d8a479](https://github.com/aws/aws-cdk/commit/7d8a4792a142f45109f35a51c6e1b3888d4111d3)), closes [#18599](https://github.com/aws/aws-cdk/issues/18599) +* **cli:** notices refresh doesn't respect the --no-notices flag ([#19226](https://github.com/aws/aws-cdk/issues/19226)) ([b3c5fe8](https://github.com/aws/aws-cdk/commit/b3c5fe8d0b695e06558bce23a6dd39b20265594f)) +* **efs:** fix bug when setting both lifecyclePolicy and outOfInfrequentAccessPolicy ([#19082](https://github.com/aws/aws-cdk/issues/19082)) ([d435ab6](https://github.com/aws/aws-cdk/commit/d435ab6120c47464427489d98bea9347983a2123)), closes [#19058](https://github.com/aws/aws-cdk/issues/19058) +* **lambda-nodejs:** local tsc detection with pre compilation ([#19266](https://github.com/aws/aws-cdk/issues/19266)) ([5de7b86](https://github.com/aws/aws-cdk/commit/5de7b86d916be6ab892e75e18c54a327fe1f65ff)), closes [#19242](https://github.com/aws/aws-cdk/issues/19242) +* **lambda-python:** asset bundling fails on windows ([#19270](https://github.com/aws/aws-cdk/issues/19270)) ([0da57da](https://github.com/aws/aws-cdk/commit/0da57da9606d982788350a6257f0f0ed6e9fd92a)), closes [#18861](https://github.com/aws/aws-cdk/issues/18861) +* **lambda-python:** docker image gets built even when we don't need to bundle assets ([#16192](https://github.com/aws/aws-cdk/issues/16192)) ([5dc61ea](https://github.com/aws/aws-cdk/commit/5dc61eabc0ea3e6294f83db5deb8528461a1d5bc)), closes [#14747](https://github.com/aws/aws-cdk/issues/14747) +* **rds:** allow cluster from snapshot to enable encrypted storage ([#19175](https://github.com/aws/aws-cdk/issues/19175)) ([bd4141d](https://github.com/aws/aws-cdk/commit/bd4141d864612974829c95d530085d4f18bdfeb8)), closes [#17241](https://github.com/aws/aws-cdk/issues/17241) +* **rds:** read replica instance cannot join domain ([#19202](https://github.com/aws/aws-cdk/issues/19202)) ([cef8fec](https://github.com/aws/aws-cdk/commit/cef8fec1b0410daa6b57c152e9bad73dcc034397)), closes [#18786](https://github.com/aws/aws-cdk/issues/18786) +* **rds:** subnet selection not respected for multi user secret rotation ([#19237](https://github.com/aws/aws-cdk/issues/19237)) ([dc7a17c](https://github.com/aws/aws-cdk/commit/dc7a17cd20198a6eb52c2ab25857e73bd7048d26)), closes [#19233](https://github.com/aws/aws-cdk/issues/19233) + ## [1.147.0](https://github.com/aws/aws-cdk/compare/v1.146.0...v1.147.0) (2022-03-01) diff --git a/version.v1.json b/version.v1.json index e4f7b428d4641..49863d6b3f443 100644 --- a/version.v1.json +++ b/version.v1.json @@ -1,3 +1,3 @@ { - "version": "1.147.0" + "version": "1.148.0" } \ No newline at end of file From efa20ee7a099250335aa5a9adcf75cc0670bffc7 Mon Sep 17 00:00:00 2001 From: Peter Woodworth <44349620+peterwoodworth@users.noreply.github.com> Date: Wed, 9 Mar 2022 14:16:51 -0800 Subject: [PATCH 05/12] chore: add triggers to automation (#19312) Adds triggers package to automation @otaviomacedo ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .github/workflows/issue-label-assign.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/issue-label-assign.yml b/.github/workflows/issue-label-assign.yml index 97e0de9be71ad..a6da82ab9565d 100644 --- a/.github/workflows/issue-label-assign.yml +++ b/.github/workflows/issue-label-assign.yml @@ -273,5 +273,6 @@ env: {"area":"@aws-cdk/yaml-cfn","keywords":["(aws-yaml-cfn)","(yaml-cfn)"],"labels":["@aws-cdk/aws-yaml-cfn"],"assignees":["skinny85"]}, {"area":"@aws-cdk/aws-apprunner","keywords":["apprunner","aws-apprunner"],"labels":["@aws-cdk/aws-apprunner"],"assignees":["corymhall"]}, {"area":"@aws-cdk/aws-lightsail","keywords":["lightsail","aws-lightsail"],"labels":["@aws-cdk/aws-lightsail"],"assignees":["corymhall"]}, - {"area":"@aws-cdk/aws-aps","keywords":["aps","aws-aps","prometheus"],"labels":["@aws-cdk/aws-aps"],"assignees":["corymhall"]} + {"area":"@aws-cdk/aws-aps","keywords":["aps","aws-aps","prometheus"],"labels":["@aws-cdk/aws-aps"],"assignees":["corymhall"]}, + {"area":"@aws-cdk/triggers","keywords":["trigger","aws-cdk/triggers","triggers"],"labels":["@aws-cdk/triggers"],"assignees":["otaviomacedo"]} ] From a6d52aa43e29b00e35d1fadd569c38b4431ffa00 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Wed, 9 Mar 2022 14:59:22 -0800 Subject: [PATCH 06/12] docs(pipelines): add examples for pipeline variables (#19288) Fixes #19184. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../pipelines/lib/codepipeline/codebuild-step.ts | 14 ++++++++++++++ .../lib/codepipeline/codepipeline-source.ts | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/codebuild-step.ts b/packages/@aws-cdk/pipelines/lib/codepipeline/codebuild-step.ts index c50d715e2cbe9..43519fdda97bf 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/codebuild-step.ts +++ b/packages/@aws-cdk/pipelines/lib/codepipeline/codebuild-step.ts @@ -234,6 +234,20 @@ export class CodeBuildStep extends ShellStep { * it finishes its `post_build` phase. * * @param variableName the name of the variable for reference. + * @example + * // Access the output of one CodeBuildStep in another CodeBuildStep + * declare const pipeline: pipelines.CodePipeline; + * + * const step1 = new pipelines.CodeBuildStep('Step1', { + * commands: ['export MY_VAR=hello'], + * }); + * + * const step2 = new pipelines.CodeBuildStep('Step2', { + * env: { + * IMPORTED_VAR: step1.exportedVariable('MY_VAR'), + * }, + * commands: ['echo $IMPORTED_VAR'], + * }); */ public exportedVariable(variableName: string): string { if (this.exportedVarsRendered && !this.exportedVariables.has(variableName)) { diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-source.ts b/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-source.ts index 0f95d41f5c940..44778af3195e5 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-source.ts +++ b/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-source.ts @@ -162,6 +162,19 @@ export abstract class CodePipelineSource extends Step implements ICodePipelineAc * - `RegistryId` * * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html#reference-variables-list + * @example + * // Access the CommitId of a GitHub source in the synth + * const source = pipelines.CodePipelineSource.gitHub('owner/repo', 'main'); + * + * const pipeline = new pipelines.CodePipeline(scope, 'MyPipeline', { + * synth: new pipelines.ShellStep('Synth', { + * input: source, + * commands: [], + * env: { + * 'COMMIT_ID': source.sourceAttribute('CommitId'), + * } + * }) + * }); */ public sourceAttribute(name: string): string { return makeCodePipelineOutput(this, name); From ab313a4abbec14a1886a7c87673dbc66354811ef Mon Sep 17 00:00:00 2001 From: Ryan Parker Date: Wed, 9 Mar 2022 17:18:20 -0800 Subject: [PATCH 07/12] feat(aws-lambda-nodejs): support additional esbuild configurations (#17788) ## Summary This PR adds support for passing in any additional esbuild args that are not already exposed in the `NodejsFunction` API. With this change a user should be able to add an esbuild option such as [`--log-limit`](https://esbuild.github.io/api/#log-limit): ```ts new NodejsFunction(scope, id, { ... bundling: { esbuildArgs: { "--log-limit": "0" } } }) ``` Resolves: https://github.com/aws/aws-cdk/issues/17768 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-lambda-nodejs/README.md | 8 +++++-- .../aws-lambda-nodejs/lib/bundling.ts | 1 + .../@aws-cdk/aws-lambda-nodejs/lib/types.ts | 22 ++++++++++++++++++- .../aws-lambda-nodejs/test/bundling.test.ts | 9 +++++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-nodejs/README.md b/packages/@aws-cdk/aws-lambda-nodejs/README.md index 1ce7d9786a4d1..a21e5c9a6001d 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/README.md +++ b/packages/@aws-cdk/aws-lambda-nodejs/README.md @@ -170,7 +170,7 @@ Docker container even if `esbuild` is available in your environment. This can be ## Configuring `esbuild` -The `NodejsFunction` construct exposes some [esbuild options](https://esbuild.github.io/api/#build-api) +The `NodejsFunction` construct exposes [esbuild options](https://esbuild.github.io/api/#build-api) via properties under `bundling`: ```ts @@ -198,7 +198,11 @@ new lambda.NodejsFunction(this, 'my-handler', { charset: lambda.Charset.UTF8, // do not escape non-ASCII characters, defaults to Charset.ASCII format: lambda.OutputFormat.ESM, // ECMAScript module output format, defaults to OutputFormat.CJS (OutputFormat.ESM requires Node.js 14.x) mainFields: ['module', 'main'], // prefer ECMAScript versions of dependencies - inject: ['./my-shim.js', './other-shim.js'] // allows to automatically replace a global variable with an import from another file + inject: ['./my-shim.js', './other-shim.js'], // allows to automatically replace a global variable with an import from another file + esbuildArgs: { // Pass additional arguments to esbuild + "--log-limit": "0", + "--splitting": true, + }, }, }); ``` diff --git a/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts b/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts index ee6b395c5d262..52b778220e179 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts +++ b/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts @@ -199,6 +199,7 @@ export class Bundling implements cdk.BundlingOptions { ...this.props.charset ? [`--charset=${this.props.charset}`] : [], ...this.props.mainFields ? [`--main-fields=${this.props.mainFields.join(',')}`] : [], ...this.props.inject ? this.props.inject.map(i => `--inject:${i}`) : [], + ...this.props.esbuildArgs ? [Object.entries(this.props.esbuildArgs).map(([key, value]) => `${key}="${value}"`).join(' ')] : [], ]; let depsCommand = ''; diff --git a/packages/@aws-cdk/aws-lambda-nodejs/lib/types.ts b/packages/@aws-cdk/aws-lambda-nodejs/lib/types.ts index 7b6b5c642f755..c9bc8f1151035 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/lib/types.ts +++ b/packages/@aws-cdk/aws-lambda-nodejs/lib/types.ts @@ -203,12 +203,32 @@ export interface BundlingOptions { */ readonly esbuildVersion?: string; + /** + * Build arguments to pass into esbuild. + * + * For example, to add the [--log-limit](https://esbuild.github.io/api/#log-limit) flag: + * + * ```text + * new NodejsFunction(scope, id, { + * ... + * bundling: { + * esbuildArgs: { + * "--log-limit": "0", + * } + * } + * }); + * ``` + * + * @default - no additional esbuild arguments are passed + */ + readonly esbuildArgs?: { [key: string]: string | boolean }; + /** * Build arguments to pass when building the bundling image. * * @default - no build arguments are passed */ - readonly buildArgs?: { [key:string] : string }; + readonly buildArgs?: { [key: string]: string }; /** * Force bundling in a Docker container even if local bundling is diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts b/packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts index 37e7fa0c94b6b..9ff0bd389e812 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts +++ b/packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts @@ -210,6 +210,11 @@ test('esbuild bundling with esbuild options', () => { }, format: OutputFormat.ESM, inject: ['./my-shim.js'], + esbuildArgs: { + '--log-limit': '0', + '--resolve-extensions': '.ts,.js', + '--splitting': 'true', + }, }); // Correctly bundles with esbuild @@ -218,7 +223,8 @@ test('esbuild bundling with esbuild options', () => { assetHashType: AssetHashType.OUTPUT, bundling: expect.objectContaining({ command: [ - 'bash', '-c', + 'bash', + '-c', [ 'esbuild --bundle "/asset-input/lib/handler.ts"', '--target=es2020 --platform=node --format=esm --outfile="/asset-output/index.mjs"', @@ -227,6 +233,7 @@ test('esbuild bundling with esbuild options', () => { '--log-level=silent --keep-names --tsconfig=/asset-input/lib/custom-tsconfig.ts', '--metafile=/asset-output/index.meta.json --banner:js="/* comments */" --footer:js="/* comments */"', '--charset=utf8 --main-fields=module,main --inject:./my-shim.js', + '--log-limit="0" --resolve-extensions=".ts,.js" --splitting="true"', ].join(' '), ], }), From 22617e4cf71131380c984d0df7a83166907e5ecc Mon Sep 17 00:00:00 2001 From: AWS CDK Automation <43080478+aws-cdk-automation@users.noreply.github.com> Date: Thu, 10 Mar 2022 01:44:47 -0800 Subject: [PATCH 08/12] docs(cfnspec): update CloudFormation documentation (#19325) Co-authored-by: AWS CDK Team --- .../@aws-cdk/cfnspec/spec-source/cfn-docs/cfn-docs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/@aws-cdk/cfnspec/spec-source/cfn-docs/cfn-docs.json b/packages/@aws-cdk/cfnspec/spec-source/cfn-docs/cfn-docs.json index ac2b4d0caddc7..d4b511aba6b77 100644 --- a/packages/@aws-cdk/cfnspec/spec-source/cfn-docs/cfn-docs.json +++ b/packages/@aws-cdk/cfnspec/spec-source/cfn-docs/cfn-docs.json @@ -32938,7 +32938,7 @@ "AllowMajorVersionUpgrade": "A value that indicates whether major version upgrades are allowed. Changing this parameter doesn't result in an outage and the change is asynchronously applied as soon as possible.\n\nConstraints: Major version upgrades must be allowed when specifying a value for the `EngineVersion` parameter that is a different major version than the DB instance's current version.", "AssociatedRoles": "The AWS Identity and Access Management (IAM) roles associated with the DB instance.", "AutoMinorVersionUpgrade": "A value that indicates whether minor engine upgrades are applied automatically to the DB instance during the maintenance window. By default, minor engine upgrades are applied automatically.", - "AvailabilityZone": "The Availability Zone (AZ) where the database will be created. For information on AWS Regions and Availability Zones, see [Regions and Availability Zones](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html) .\n\n*Amazon Aurora*\n\nNot applicable. Availability Zones are managed by the DB cluster.\n\nDefault: A random, system-chosen Availability Zone in the endpoint's AWS Region.\n\nExample: `us-east-1d`\n\nConstraint: The `AvailabilityZone` parameter can't be specified if the DB instance is a Multi-AZ deployment. The specified Availability Zone must be in the same AWS Region as the current endpoint.\n\n> If you're creating a DB instance in an RDS on VMware environment, specify the identifier of the custom Availability Zone to create the DB instance in.\n> \n> For more information about RDS on VMware, see the [RDS on VMware User Guide.](https://docs.aws.amazon.com/AmazonRDS/latest/RDSonVMwareUserGuide/rds-on-vmware.html)", + "AvailabilityZone": "The Availability Zone (AZ) where the database will be created. For information on AWS Regions and Availability Zones, see [Regions and Availability Zones](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html) .\n\n*Amazon Aurora*\n\nNot applicable. Availability Zones are managed by the DB cluster.\n\nDefault: A random, system-chosen Availability Zone in the endpoint's AWS Region .\n\nExample: `us-east-1d`\n\nConstraint: The `AvailabilityZone` parameter can't be specified if the DB instance is a Multi-AZ deployment. The specified Availability Zone must be in the same AWS Region as the current endpoint.\n\n> If you're creating a DB instance in an RDS on VMware environment, specify the identifier of the custom Availability Zone to create the DB instance in.\n> \n> For more information about RDS on VMware, see the [RDS on VMware User Guide.](https://docs.aws.amazon.com/AmazonRDS/latest/RDSonVMwareUserGuide/rds-on-vmware.html)", "BackupRetentionPeriod": "The number of days for which automated backups are retained. Setting this parameter to a positive number enables backups. Setting this parameter to 0 disables automated backups.\n\n*Amazon Aurora*\n\nNot applicable. The retention period for automated backups is managed by the DB cluster.\n\nDefault: 1\n\nConstraints:\n\n- Must be a value from 0 to 35\n- Can't be set to 0 if the DB instance is a source to read replicas", "CACertificateIdentifier": "The identifier of the CA certificate for this DB instance.\n\n> Specifying or updating this property triggers a reboot. \n\nFor more information about CA certificate identifiers for RDS DB engines, see [Rotating Your SSL/TLS Certificate](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL-certificate-rotation.html) in the *Amazon RDS User Guide* .\n\nFor more information about CA certificate identifiers for Aurora DB engines, see [Rotating Your SSL/TLS Certificate](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.SSL-certificate-rotation.html) in the *Amazon Aurora User Guide* .", "CharacterSetName": "For supported engines, indicates that the DB instance should be associated with the specified character set.\n\n*Amazon Aurora*\n\nNot applicable. The character set is managed by the DB cluster. For more information, see [AWS::RDS::DBCluster](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html) .", @@ -32957,7 +32957,7 @@ "DomainIAMRoleName": "Specify the name of the IAM role to be used when making API calls to the Directory Service.\n\nThis setting doesn't apply to RDS Custom.", "EnableCloudwatchLogsExports": "The list of log types that need to be enabled for exporting to CloudWatch Logs. The values in the list depend on the DB engine being used. For more information, see [Publishing Database Logs to Amazon CloudWatch Logs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch) in the *Amazon Relational Database Service User Guide* .\n\n*Amazon Aurora*\n\nNot applicable. CloudWatch Logs exports are managed by the DB cluster.\n\n*MariaDB*\n\nValid values: `audit` , `error` , `general` , `slowquery`\n\n*Microsoft SQL Server*\n\nValid values: `agent` , `error`\n\n*MySQL*\n\nValid values: `audit` , `error` , `general` , `slowquery`\n\n*Oracle*\n\nValid values: `alert` , `audit` , `listener` , `trace`\n\n*PostgreSQL*\n\nValid values: `postgresql` , `upgrade`", "EnableIAMDatabaseAuthentication": "A value that indicates whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts. By default, mapping is disabled.\n\nFor more information, see [IAM Database Authentication for MySQL and PostgreSQL](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) in the *Amazon RDS User Guide.*\n\n*Amazon Aurora*\n\nNot applicable. Mapping AWS IAM accounts to database accounts is managed by the DB cluster.", - "EnablePerformanceInsights": "A value that indicates whether to enable Performance Insights for the DB instance. For more information, see [Using Amazon Performance Insights](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html) in the *Amazon Relational Database Service User Guide* .\n\nThis setting doesn't apply to RDS Custom.", + "EnablePerformanceInsights": "A value that indicates whether to enable Performance Insights for the DB instance. For more information, see [Using Amazon Performance Insights](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html) in the *Amazon RDS User Guide* .\n\nThis setting doesn't apply to RDS Custom.", "Engine": "The name of the database engine that you want to use for this DB instance.\n\n> When you are creating a DB instance, the `Engine` property is required. \n\nValid Values:\n\n- `aurora` (for MySQL 5.6-compatible Aurora)\n- `aurora-mysql` (for MySQL 5.7-compatible Aurora)\n- `aurora-postgresql`\n- `mariadb`\n- `mysql`\n- `oracle-ee`\n- `oracle-se2`\n- `oracle-se1`\n- `oracle-se`\n- `postgres`\n- `sqlserver-ee`\n- `sqlserver-se`\n- `sqlserver-ex`\n- `sqlserver-web`", "EngineVersion": "The version number of the database engine to use.\n\nFor a list of valid engine versions, use the `DescribeDBEngineVersions` action.\n\nThe following are the database engines and links to information about the major and minor versions that are available with Amazon RDS. Not every database engine is available for every AWS Region.\n\n*Amazon Aurora*\n\nNot applicable. The version number of the database engine to be used by the DB instance is managed by the DB cluster.\n\n*MariaDB*\n\nSee [MariaDB on Amazon RDS Versions](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MariaDB.html#MariaDB.Concepts.VersionMgmt) in the *Amazon RDS User Guide.*\n\n*Microsoft SQL Server*\n\nSee [Microsoft SQL Server Versions on Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.VersionSupport) in the *Amazon RDS User Guide.*\n\n*MySQL*\n\nSee [MySQL on Amazon RDS Versions](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.VersionMgmt) in the *Amazon RDS User Guide.*\n\n*Oracle*\n\nSee [Oracle Database Engine Release Notes](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.PatchComposition.html) in the *Amazon RDS User Guide.*\n\n*PostgreSQL*\n\nSee [Supported PostgreSQL Database Versions](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.DBVersions) in the *Amazon RDS User Guide.*", "Iops": "The number of I/O operations per second (IOPS) that the database provisions. The value must be equal to or greater than 1000.\n\nIf you specify this property, you must follow the range of allowed ratios of your requested IOPS rate to the amount of storage that you allocate (IOPS to allocated storage). For example, you can provision an Oracle database instance with 1000 IOPS and 200 GiB of storage (a ratio of 5:1), or specify 2000 IOPS with 200 GiB of storage (a ratio of 10:1). For more information, see [Amazon RDS Provisioned IOPS Storage to Improve Performance](https://docs.aws.amazon.com/AmazonRDS/latest/DeveloperGuide/CHAP_Storage.html#USER_PIOPS) in the *Amazon RDS User Guide* .\n\n> If you specify `io1` for the `StorageType` property, then you must also specify the `Iops` property.", @@ -33025,7 +33025,7 @@ "description": "The `AWS::RDS::DBProxy` resource creates or updates a DB proxy.\n\nFor information about RDS Proxy for Amazon RDS, see [Managing Connections with Amazon RDS Proxy](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html) in the *Amazon RDS User Guide* .\n\nFor information about RDS Proxy for Amazon Aurora, see [Managing Connections with Amazon RDS Proxy](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/rds-proxy.html) in the *Amazon Aurora User Guide* .\n\n> Limitations apply to RDS Proxy, including DB engine version limitations and AWS Region limitations.\n> \n> For information about limitations that apply to RDS Proxy for Amazon RDS, see [Limitations for RDS Proxy](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html#rds-proxy.limitations) in the *Amazon RDS User Guide* .\n> \n> For information about that apply to RDS Proxy for Amazon Aurora, see [Limitations for RDS Proxy](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/rds-proxy.html#rds-proxy.limitations) in the *Amazon Aurora User Guide* .", "properties": { "Auth": "The authorization mechanism that the proxy uses.", - "DBProxyName": "The identifier for the proxy. This name must be unique for all proxies owned by your AWS account in the specified AWS Region. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.", + "DBProxyName": "The identifier for the proxy. This name must be unique for all proxies owned by your AWS account in the specified AWS Region . An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.", "DebugLogging": "Whether the proxy includes detailed information about SQL statements in its logs. This information helps you to debug issues involving SQL behavior or the performance and scalability of the proxy connections. The debug information includes the text of SQL statements that you submit through the proxy. Thus, only enable this setting when needed for debugging, and only when you have security measures in place to safeguard any sensitive information that appears in the logs.", "EngineFamily": "The kinds of databases that the proxy can connect to. This value determines which database network protocol the proxy recognizes when it interprets network traffic to and from the database. The engine family applies to MySQL and PostgreSQL for both RDS and Aurora.\n\n*Valid values* : `MYSQL` | `POSTGRESQL`", "IdleClientTimeout": "The number of seconds that a connection to the proxy can be inactive before the proxy disconnects it. You can set this value higher or lower than the connection timeout limit for the associated database.", From e26442c6cdbef930c31b95feca002482edbb48d2 Mon Sep 17 00:00:00 2001 From: Dhruv Dakoria Date: Thu, 10 Mar 2022 12:05:46 -0500 Subject: [PATCH 09/12] chore(docs): Fix contributing.md typo (#19171) Fix typos in CONTRIBUTING.md ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 25ed091ee83e4..ba1e2a49f5c97 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,7 +89,7 @@ specific to the CDK. ### Build -The full build of the CDK takes a long time complete; 1-2 hours depending on the performance of the build machine. +The full build of the CDK takes a long time to complete; 1-2 hours depending on the performance of the build machine. However, most first time contributions will require changing only one CDK module, sometimes two. A full build of the CDK is not required in these cases. @@ -481,7 +481,7 @@ grantAwesomePowerBeta1(); ``` Times goes by, we get feedback that this method will actually be much better -if it accept a `Principal`. Since adding a required property is a breaking +if it accepts a `Principal`. Since adding a required property is a breaking change, we will add `grantAwesomePowerBeta2()` and deprecate `grantAwesomePowerBeta1`: From bbed27d95ab2724db937964d01aec5564a77e84f Mon Sep 17 00:00:00 2001 From: Pat Myron Date: Thu, 10 Mar 2022 14:09:44 -0800 Subject: [PATCH 10/12] feat(lambda): dotnet6 runtime (#19144) fix https://github.com/aws/aws-lambda-dotnet/issues/1088, fix https://github.com/aws/aws-cdk/issues/19148 https://aws.amazon.com/about-aws/whats-new/2022/02/aws-lambda-adds-support-net6/ https://aws.amazon.com/blogs/compute/introducing-the-net-6-runtime-for-aws-lambda/ https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-lambda/lib/runtime.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/@aws-cdk/aws-lambda/lib/runtime.ts b/packages/@aws-cdk/aws-lambda/lib/runtime.ts index 9c0e305d4441e..5c3d918302060 100644 --- a/packages/@aws-cdk/aws-lambda/lib/runtime.ts +++ b/packages/@aws-cdk/aws-lambda/lib/runtime.ts @@ -137,6 +137,11 @@ export class Runtime { supportsCodeGuruProfiling: true, }); + /** + * The .NET 6 runtime (dotnet6) + */ + public static readonly DOTNET_6 = new Runtime('dotnet6', RuntimeFamily.DOTNET_CORE); + /** * The .NET Core 1.0 runtime (dotnetcore1.0) * Legacy runtime no longer supported by AWS Lambda. From 1bc5144b05938829f90b89001ccda8fd4aefe343 Mon Sep 17 00:00:00 2001 From: Peter Woodworth <44349620+peterwoodworth@users.noreply.github.com> Date: Thu, 10 Mar 2022 15:38:30 -0800 Subject: [PATCH 11/12] fix(lambda-event-sources): increase batch size restriction (#19317) fixes #19285 I can successfully deploy a stack by overriding the batch size to 10000 - need to contact cloudformation team to update their docs ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-lambda-event-sources/lib/dynamodb.ts | 4 ++-- .../aws-lambda-event-sources/test/dynamo.test.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts b/packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts index 3d0fd78c915fc..80082453b5d84 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts @@ -17,8 +17,8 @@ export class DynamoEventSource extends StreamEventSource { if (this.props.batchSize !== undefined && !Token.isUnresolved(this.props.batchSize) - && (this.props.batchSize < 1 || this.props.batchSize > 1000)) { - throw new Error(`Maximum batch size must be between 1 and 1000 inclusive (given ${this.props.batchSize})`); + && (this.props.batchSize < 1 || this.props.batchSize > 10000)) { + throw new Error(`Maximum batch size must be between 1 and 10000 inclusive (given ${this.props.batchSize})`); } } diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/dynamo.test.ts b/packages/@aws-cdk/aws-lambda-event-sources/test/dynamo.test.ts index 97bd42c07145f..a4b210156aae6 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/dynamo.test.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/dynamo.test.ts @@ -116,7 +116,7 @@ describe('DynamoEventSource', () => { // WHEN fn.addEventSource(new sources.DynamoEventSource(table, { - batchSize: 50, + batchSize: 5000, startingPosition: lambda.StartingPosition.LATEST, })); @@ -131,7 +131,7 @@ describe('DynamoEventSource', () => { 'FunctionName': { 'Ref': 'Fn9270CBC0', }, - 'BatchSize': 50, + 'BatchSize': 5000, 'StartingPosition': 'LATEST', }); @@ -153,7 +153,7 @@ describe('DynamoEventSource', () => { type: 'Number', default: 100, minValue: 1, - maxValue: 1000, + maxValue: 10000, }); // WHEN fn.addEventSource(new sources.DynamoEventSource(table, { @@ -217,12 +217,12 @@ describe('DynamoEventSource', () => { expect(() => fn.addEventSource(new sources.DynamoEventSource(table, { batchSize: 0, startingPosition: lambda.StartingPosition.LATEST, - }))).toThrow(/Maximum batch size must be between 1 and 1000 inclusive \(given 0\)/); + }))).toThrow(/Maximum batch size must be between 1 and 10000 inclusive \(given 0\)/); }); - test('fails if batch size > 1000', () => { + test('fails if batch size > 10000', () => { // GIVEN const stack = new cdk.Stack(); const fn = new TestFunction(stack, 'Fn'); @@ -236,9 +236,9 @@ describe('DynamoEventSource', () => { // WHEN expect(() => fn.addEventSource(new sources.DynamoEventSource(table, { - batchSize: 1001, + batchSize: 10001, startingPosition: lambda.StartingPosition.LATEST, - }))).toThrow(/Maximum batch size must be between 1 and 1000 inclusive \(given 1001\)/); + }))).toThrow(/Maximum batch size must be between 1 and 10000 inclusive \(given 10001\)/); }); From 1875c28865690d59c22939039a5d0e37039ab63c Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Thu, 10 Mar 2022 17:44:56 -0800 Subject: [PATCH 12/12] fix(cli): failure to load malformed YAML is swallowed (#19338) For some reason, we are falling back to reading JSON when loading YAML fails. Since YAML is a superset of JSON, the only reason errors would occur because the YAML is not valid, in which case we shouldn't do this catch at all. Fixes #19335. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/serialize.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/aws-cdk/lib/serialize.ts b/packages/aws-cdk/lib/serialize.ts index 62a9bb70c3322..ea7ea30c3b89c 100644 --- a/packages/aws-cdk/lib/serialize.ts +++ b/packages/aws-cdk/lib/serialize.ts @@ -12,12 +12,7 @@ export function toYAML(obj: any): string { * Parse either YAML or JSON */ export function deserializeStructure(str: string): any { - try { - return yaml_cfn.deserialize(str); - } catch (e) { - // This shouldn't really ever happen I think, but it's the code we had so I'm leaving it. - return JSON.parse(str); - } + return yaml_cfn.deserialize(str); } /**