Skip to content

Commit 07c6775

Browse files
authored
fix(triggers): errors are shown as list of bytes (#27119)
With Triggers a user can invoke a Lambda Function during every stack deployment. When we migrated the handler code to SDKv3, we overlooked that the return payload from the invoked lambda function is now a `Uint8Array`, and not a string anymore. In the error case, we attempt to `JSON.parse()` the error payload which then resulted in a list of bytes being returned to the user. Updated the handler test case to use correct mocks, including returning a payload that is a Uint8Array. Closes #27113 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent eb1d363 commit 07c6775

File tree

13 files changed

+280
-192
lines changed

13 files changed

+280
-192
lines changed

packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/MyStack.assets.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"version": "34.0.0",
33
"files": {
4-
"1c4fbe52107a02bc3832ff0608df37583b37909cc2fb431f405c157fdc63b2e1": {
4+
"a0c9975917e46ed0aa8a6428132c7b9164aa1ef177f38f962f1def169eddf951": {
55
"source": {
6-
"path": "asset.1c4fbe52107a02bc3832ff0608df37583b37909cc2fb431f405c157fdc63b2e1",
6+
"path": "asset.a0c9975917e46ed0aa8a6428132c7b9164aa1ef177f38f962f1def169eddf951",
77
"packaging": "zip"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "1c4fbe52107a02bc3832ff0608df37583b37909cc2fb431f405c157fdc63b2e1.zip",
12+
"objectKey": "a0c9975917e46ed0aa8a6428132c7b9164aa1ef177f38f962f1def169eddf951.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
@@ -27,15 +27,15 @@
2727
}
2828
}
2929
},
30-
"239e1222881873abff6cdef51f8e3c638744b51baa96c81ce6d806f327d47c64": {
30+
"5deea9a1098892456fc282a7590321fe178d26a3ea864fd5c11fa2e392fe574c": {
3131
"source": {
3232
"path": "MyStack.template.json",
3333
"packaging": "file"
3434
},
3535
"destinations": {
3636
"current_account-current_region": {
3737
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
38-
"objectKey": "239e1222881873abff6cdef51f8e3c638744b51baa96c81ce6d806f327d47c64.json",
38+
"objectKey": "5deea9a1098892456fc282a7590321fe178d26a3ea864fd5c11fa2e392fe574c.json",
3939
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
4040
}
4141
}

packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/MyStack.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
"S3Bucket": {
239239
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
240240
},
241-
"S3Key": "1c4fbe52107a02bc3832ff0608df37583b37909cc2fb431f405c157fdc63b2e1.zip"
241+
"S3Key": "a0c9975917e46ed0aa8a6428132c7b9164aa1ef177f38f962f1def169eddf951.zip"
242242
},
243243
"Timeout": 900,
244244
"MemorySize": 128,

packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.assets.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
22
"version": "34.0.0",
33
"files": {
4-
"77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754": {
4+
"f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971": {
55
"source": {
6-
"path": "asset.77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754.bundle",
6+
"path": "asset.f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971.bundle",
77
"packaging": "zip"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754.zip",
12+
"objectKey": "f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
1616
},
17-
"187dc9b0238204b903862ffef4a8cb4b20d9c18d252845731a6a0bfe60114ed7": {
17+
"8592b210c476c91c8b979c0709e8da1bf3a1a5d12ef0bcc8bbbe8ed17ca45378": {
1818
"source": {
1919
"path": "TriggerTestDefaultTestDeployAssert61636546.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "187dc9b0238204b903862ffef4a8cb4b20d9c18d252845731a6a0bfe60114ed7.json",
25+
"objectKey": "8592b210c476c91c8b979c0709e8da1bf3a1a5d12ef0bcc8bbbe8ed17ca45378.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.template.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"outputPaths": [
3636
"Messages.0.Body"
3737
],
38-
"salt": "1694456719494"
38+
"salt": "1694604354167"
3939
},
4040
"UpdateReplacePolicy": "Delete",
4141
"DeletionPolicy": "Delete"
@@ -215,7 +215,7 @@
215215
"S3Bucket": {
216216
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
217217
},
218-
"S3Key": "77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754.zip"
218+
"S3Key": "f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971.zip"
219219
},
220220
"Timeout": 120,
221221
"Handler": "index.handler",
@@ -276,7 +276,7 @@
276276
"S3Bucket": {
277277
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
278278
},
279-
"S3Key": "77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754.zip"
279+
"S3Key": "f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971.zip"
280280
},
281281
"Timeout": 120,
282282
"Handler": "index.isComplete",
@@ -318,7 +318,7 @@
318318
"S3Bucket": {
319319
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
320320
},
321-
"S3Key": "77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754.zip"
321+
"S3Key": "f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971.zip"
322322
},
323323
"Timeout": 120,
324324
"Handler": "index.onTimeout",

packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/asset.1c4fbe52107a02bc3832ff0608df37583b37909cc2fb431f405c157fdc63b2e1/index.js

-89
This file was deleted.

0 commit comments

Comments
 (0)