-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
### Issue # (if applicable) Closes aws#31458. ### Reason for this change According to the documentation [here](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html#filtering-syntax), the FilterPattern should be [null]. However, the function FilterRule.null() currently returns an empty array [] instead. It results an invalid filter pattern definition. ### Description of changes Change the return value from `[]` to `[null]` ### Description of how you validated changes Add an integration test to validate the new return value. Also with the old return value, the deployment will fail with error `Invalid request provided: Invalid filter pattern definition.` so it should break existing customers. ### 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) **BREAKING CHANGE**: The function return value changes from `String[]` to `any` which could be a breaking change in some cases. However, the previous return value would fail the deployment hence it reduces the risk of breaking change. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{ | ||
"Resources": { | ||
"FuncServiceRole49680D06": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "lambda.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"FuncServiceRoleDefaultPolicy588DA782": { | ||
"Type": "AWS::IAM::Policy", | ||
"Properties": { | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"sqs:ChangeMessageVisibility", | ||
"sqs:DeleteMessage", | ||
"sqs:GetQueueAttributes", | ||
"sqs:GetQueueUrl", | ||
"sqs:ReceiveMessage" | ||
], | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Fn::GetAtt": [ | ||
"Queue4A7E3555", | ||
"Arn" | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"PolicyName": "FuncServiceRoleDefaultPolicy588DA782", | ||
"Roles": [ | ||
{ | ||
"Ref": "FuncServiceRole49680D06" | ||
} | ||
] | ||
} | ||
}, | ||
"Func217E03A4": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties": { | ||
"Code": { | ||
"ZipFile": "exports.handler = async function handler(event) {\n console.log('event:', JSON.stringify(event, undefined, 2));\n return { event };\n}" | ||
}, | ||
"Handler": "index.handler", | ||
"Role": { | ||
"Fn::GetAtt": [ | ||
"FuncServiceRole49680D06", | ||
"Arn" | ||
] | ||
}, | ||
"Runtime": "nodejs18.x" | ||
}, | ||
"DependsOn": [ | ||
"FuncServiceRoleDefaultPolicy588DA782", | ||
"FuncServiceRole49680D06" | ||
] | ||
}, | ||
"FuncSqsEventSourcelambdaeventsourcefiltercriterianullQueueCEF92D9AD2F13C0B": { | ||
"Type": "AWS::Lambda::EventSourceMapping", | ||
"Properties": { | ||
"BatchSize": 5, | ||
"EventSourceArn": { | ||
"Fn::GetAtt": [ | ||
"Queue4A7E3555", | ||
"Arn" | ||
] | ||
}, | ||
"FilterCriteria": { | ||
"Filters": [ | ||
{ | ||
"Pattern": "{\"body\":{\"id\":[null]}}" | ||
} | ||
] | ||
}, | ||
"FunctionName": { | ||
"Ref": "Func217E03A4" | ||
} | ||
} | ||
}, | ||
"Queue4A7E3555": { | ||
"Type": "AWS::SQS::Queue", | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.