Skip to content

Commit fa21e62

Browse files
authored
fix(lambda): fix typo in addPermission() warning message (#37365)
### Reason for this change The warning message displayed by `addPermission()` when called on a Lambda Function with mismatched environments contains a typo: "this is is intentional" (duplicated "is"). ### Description of changes Fix `this is is intentional` → `this is intentional` in: - `packages/aws-cdk-lib/aws-lambda/lib/function-base.ts` (source) - `packages/aws-cdk-lib/aws-lambda/test/function.test.ts` (test assertion) ### Description of how you validated changes Updated the corresponding test assertion to match the corrected message. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
1 parent 69c8944 commit fa21e62

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/aws-cdk-lib/aws-lambda/lib/function-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export abstract class FunctionBase extends Resource implements IFunction, ec2.IC
406406
public addPermission(id: string, permission: Permission) {
407407
if (!this.canCreatePermissions) {
408408
if (!this._skipPermissions) {
409-
Annotations.of(this).addWarningV2('UnclearLambdaEnvironment', `addPermission() has no effect on a Lambda Function with region=${this.env.region}, account=${this.env.account}, in a Stack with region=${Stack.of(this).region}, account=${Stack.of(this).account}. Suppress this warning if this is is intentional, or pass sameEnvironment=true to fromFunctionAttributes() if you would like to add the permissions.`);
409+
Annotations.of(this).addWarningV2('UnclearLambdaEnvironment', `addPermission() has no effect on a Lambda Function with region=${this.env.region}, account=${this.env.account}, in a Stack with region=${Stack.of(this).region}, account=${Stack.of(this).account}. Suppress this warning if this is intentional, or pass sameEnvironment=true to fromFunctionAttributes() if you would like to add the permissions.`);
410410
}
411411
return;
412412
}

packages/aws-cdk-lib/aws-lambda/test/function.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ describe('function', () => {
252252

253253
expect(getWarnings(app.synth())).toEqual([
254254
{
255-
message: expect.stringMatching(/^addPermission\(\) has no effect on a Lambda Function with region=us-west-2, account=123456789012, in a Stack with region=\${Token\[AWS\.Region\.\d+]}, account=\${Token\[AWS\.AccountId\.\d+]}. Suppress this warning if this is is intentional, or pass sameEnvironment=true to fromFunctionAttributes\(\) if you would like to add the permissions\. \[ack: UnclearLambdaEnvironment]$/),
255+
message: expect.stringMatching(/^addPermission\(\) has no effect on a Lambda Function with region=us-west-2, account=123456789012, in a Stack with region=\${Token\[AWS\.Region\.\d+]}, account=\${Token\[AWS\.AccountId\.\d+]}. Suppress this warning if this is intentional, or pass sameEnvironment=true to fromFunctionAttributes\(\) if you would like to add the permissions\. \[ack: UnclearLambdaEnvironment]$/),
256256
path: '/Default/Imported',
257257
},
258258
]);

0 commit comments

Comments
 (0)