Skip to content

Commit

Permalink
fix(triggers): executed on update even when executeOnHandlerChange is…
Browse files Browse the repository at this point in the history
… false (#26676)

Currently, trigger is re-executed every time when the handler function code or configuration changes even if executeOnHandlerChange is set to false. This is because executeOnHandlerChange prop is never used in the current implementation. 

This PR solves the issue by referring executeOnHandlerChange prop and skipping function invocation when executeOnHandlerChange is set to false.

Closes #25939

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
tam0ri authored Aug 10, 2023
1 parent 19e1eb6 commit ed3aaf7
Show file tree
Hide file tree
Showing 16 changed files with 1,635 additions and 943 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "32.0.0",
"version": "33.0.0",
"files": {
"bcb8f5f1cebce365c4a0bf886b9820908bb469b121d65ef42809ae9798fb9232": {
"237e4a416773a5765262a8b9c70210bd35dfd48ae5a364b19e35f260026b5139": {
"source": {
"path": "asset.bcb8f5f1cebce365c4a0bf886b9820908bb469b121d65ef42809ae9798fb9232",
"path": "asset.237e4a416773a5765262a8b9c70210bd35dfd48ae5a364b19e35f260026b5139",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "bcb8f5f1cebce365c4a0bf886b9820908bb469b121d65ef42809ae9798fb9232.zip",
"objectKey": "237e4a416773a5765262a8b9c70210bd35dfd48ae5a364b19e35f260026b5139.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand All @@ -27,15 +27,15 @@
}
}
},
"2aba455d6086d5fb7be6c191dd151bacd3ced3db7a93799474386bb144c6d89a": {
"d70b0346c408b6c05836b626356b50a8a99a92a3fe6ea2e281a97ecf03dd1201": {
"source": {
"path": "MyStack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "2aba455d6086d5fb7be6c191dd151bacd3ced3db7a93799474386bb144c6d89a.json",
"objectKey": "d70b0346c408b6c05836b626356b50a8a99a92a3fe6ea2e281a97ecf03dd1201.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
"Code": {
"ZipFile": "exports.handler = function() { console.log(\"hi\"); };"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"MyTriggerFunctionServiceRole1BB78C29",
"Arn"
]
},
"Handler": "index.handler",
"Runtime": "nodejs16.x"
},
"DependsOn": [
Expand All @@ -72,7 +72,8 @@
"Ref": "MyTriggerFunctionCurrentVersion61957CE160cd5b4c06c4d00191dc10a647ea0777"
},
"InvocationType": "RequestResponse",
"Timeout": "120000"
"Timeout": "120000",
"ExecuteOnHandlerChange": true
},
"DependsOn": [
"Topic269377B75"
Expand Down Expand Up @@ -237,7 +238,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "bcb8f5f1cebce365c4a0bf886b9820908bb469b121d65ef42809ae9798fb9232.zip"
"S3Key": "237e4a416773a5765262a8b9c70210bd35dfd48ae5a364b19e35f260026b5139.zip"
},
"Timeout": 900,
"MemorySize": 128,
Expand Down Expand Up @@ -299,13 +300,13 @@
"Code": {
"ZipFile": "exports.handler = async function() { await setTimeout(() => {console.log(\"hi\")}, 3*60*1000); };"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"MyLambdaFunctionServiceRole313A4D46",
"Arn"
]
},
"Handler": "index.handler",
"Runtime": "nodejs16.x",
"Timeout": 900
},
Expand Down Expand Up @@ -334,7 +335,8 @@
"Ref": "MyLambdaFunctionCurrentVersion4FAB80EC75f2df347bcc21ea05f818cb68778d9f"
},
"InvocationType": "Event",
"Timeout": "60000"
"Timeout": "60000",
"ExecuteOnHandlerChange": true
},
"DependsOn": [
"Topic198E71B3E",
Expand Down Expand Up @@ -413,12 +415,6 @@
},
"S3Key": "004b12857696fed3c10ad54c8e3cabd07cdf653ec469cbadab6c64ae6c9ce690.zip"
},
"Role": {
"Fn::GetAtt": [
"MyAssertionLambdaFunctionServiceRole36146F3B",
"Arn"
]
},
"Environment": {
"Variables": {
"QUEUE_URL": {
Expand All @@ -427,6 +423,12 @@
}
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"MyAssertionLambdaFunctionServiceRole36146F3B",
"Arn"
]
},
"Runtime": "nodejs16.x",
"Timeout": 900
},
Expand Down Expand Up @@ -456,7 +458,8 @@
"Ref": "MyAssertionLambdaFunctionCurrentVersionF4FA4C80f14c7075b9f4d7c63066e881d45e211c"
},
"InvocationType": "RequestResponse",
"Timeout": "60000"
"Timeout": "60000",
"ExecuteOnHandlerChange": true
},
"DependsOn": [
"TestQueue6F0069AA"
Expand Down Expand Up @@ -501,13 +504,13 @@
"Code": {
"ZipFile": "exports.handler = function() { console.log(\"hello\"); };"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"MySecondFunctionServiceRole5B930841",
"Arn"
]
},
"Handler": "index.handler",
"Runtime": "nodejs16.x"
},
"DependsOn": [
Expand All @@ -527,7 +530,8 @@
"Ref": "MySecondFunctionCurrentVersion7D497B5D173a4bb1f758991022ea97d651403362"
},
"InvocationType": "RequestResponse",
"Timeout": "120000"
"Timeout": "120000",
"ExecuteOnHandlerChange": true
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand All @@ -553,7 +557,8 @@
"Ref": "MyLambdaFunctionCurrentVersion4FAB80EC75f2df347bcc21ea05f818cb68778d9f"
},
"InvocationType": "RequestResponse",
"Timeout": "120000"
"Timeout": "120000",
"ExecuteOnHandlerChange": true
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"version": "32.0.0",
"version": "33.0.0",
"files": {
"86e6ecbc86f6febc745cde7ce633979efa869d6d493b12f2c9d8641d70caa7c2": {
"e4815916885b43e053d8fcef603638aa3a4754c27a3cb0d21fd1c50c2923415b": {
"source": {
"path": "asset.86e6ecbc86f6febc745cde7ce633979efa869d6d493b12f2c9d8641d70caa7c2.bundle",
"path": "asset.e4815916885b43e053d8fcef603638aa3a4754c27a3cb0d21fd1c50c2923415b.bundle",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "86e6ecbc86f6febc745cde7ce633979efa869d6d493b12f2c9d8641d70caa7c2.zip",
"objectKey": "e4815916885b43e053d8fcef603638aa3a4754c27a3cb0d21fd1c50c2923415b.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"506333024aade6ef1f4c1b78000bbc1e1307f8003bad9422adb127768f97739b": {
"033efbe16b566cb69151acaa2d38b2c1f73bf411f644ae441daf0c6aec5a6697": {
"source": {
"path": "TriggerTestDefaultTestDeployAssert61636546.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "506333024aade6ef1f4c1b78000bbc1e1307f8003bad9422adb127768f97739b.json",
"objectKey": "033efbe16b566cb69151acaa2d38b2c1f73bf411f644ae441daf0c6aec5a6697.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,24 @@
},
"parameters": {
"QueueUrl": {
"Fn::ImportValue": "MyStack:ExportsOutputRefTestQueue6F0069AA4C7E94E2"
"Fn::Join": [
"",
[
"\"",
{
"Fn::ImportValue": "MyStack:ExportsOutputRefTestQueue6F0069AA4C7E94E2"
},
"\""
]
]
},
"WaitTimeSeconds": 20
"WaitTimeSeconds": "20"
},
"flattenResponse": "true",
"outputPaths": [
"Messages.0.Body"
],
"salt": "1688619578418"
"salt": "1691559124118"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand Down Expand Up @@ -206,7 +215,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "86e6ecbc86f6febc745cde7ce633979efa869d6d493b12f2c9d8641d70caa7c2.zip"
"S3Key": "e4815916885b43e053d8fcef603638aa3a4754c27a3cb0d21fd1c50c2923415b.zip"
},
"Timeout": 120,
"Handler": "index.handler",
Expand Down Expand Up @@ -267,7 +276,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "86e6ecbc86f6febc745cde7ce633979efa869d6d493b12f2c9d8641d70caa7c2.zip"
"S3Key": "e4815916885b43e053d8fcef603638aa3a4754c27a3cb0d21fd1c50c2923415b.zip"
},
"Timeout": 120,
"Handler": "index.isComplete",
Expand Down Expand Up @@ -309,7 +318,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "86e6ecbc86f6febc745cde7ce633979efa869d6d493b12f2c9d8641d70caa7c2.zip"
"S3Key": "e4815916885b43e053d8fcef603638aa3a4754c27a3cb0d21fd1c50c2923415b.zip"
},
"Timeout": 120,
"Handler": "index.onTimeout",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ed3aaf7

Please sign in to comment.