Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggers: Error case returns bytes #27113

Closed
mrgrain opened this issue Sep 12, 2023 · 1 comment · Fixed by #27119
Closed

Triggers: Error case returns bytes #27113

mrgrain opened this issue Sep 12, 2023 · 1 comment · Fixed by #27119
Assignees
Labels
@aws-cdk/triggers Related to the triggers package bug This issue is a bug. node18-upgrade Any work (bug, feature) related to Node 18 upgrade sdk-v3-upgrade Tag issues that are associated to SDK V3 upgrade. Not limited to CR usage of SDK only.

Comments

@mrgrain
Copy link
Contributor

mrgrain commented Sep 12, 2023

In the integ test triggers/test/integ.triggers.ts
Go and find the test handler in the lib directory and break it.
Run the test case and see it fail with an error similar to the one below.

This is bad for users of Triggers, since they won't be able to debug their Triggers anymore.

The stack named MyStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Received response status [FAILED] from custom resource. Message returned: Error: 123,34,101,114,114,111,114,84,121,112,101,34,58,34,82,117,110,116,105,109,101,46,73,109,112,111,114,116,77,111,100,117,108,101,69,114,114,111,114,34,44,34,101,114,114,111,114,77,101,115,115,97,103,101,34,58,34,69,114,114,111,114,58,32,67,97,110,110,111,116,32,102,105,110,100,32,109,111,100,117,108,101,32,39,97,119,115,45,115,100,107,39,92,110,82,101,113,117,105,114,101,32,115,116,97,99,107,58,92,110,45,32,47,118,97,114,47,116,97,115,107,47,105,110,100,101,120,46,106,115,92,110,45,32,47,118,97,114,47,114,117,110,116,105,109,101,47,105,110,100,101,120,46,109,106,115,34,44,34,116,114,97,99,101,34,58,91,34,82,117,110,116,105,109,101,46,73,109,112,111,114,116,77,111,100,117,108,101,69,114,114,111,114,58,32,69,114,114,111,114,58,32,67,97,110,110,111,116,32,102,105,110,100,32,109,111,100,117,108,101,32,39,97,119,115,45,115,100,107,39,34,44,34,82,101,113,117,105,114,101,32,115,116,97,99,107,58,34,44,34,45,32,47,118,97,114,47,116,97,115,107,47,105,110,100,101,120,46,106,115,34,44,34,45,32,47,118,97,114,47,114,117,110,116,105,109,101,47,105,110,100,101,120,46,109,106,115,34,44,34,32,32,32,32,97,116,32,95,108,111,97,100,85,115,101,114,65,112,112,32,40,102,105,108,101,58,47,47,47,118,97,114,47,114,117,110,116,105,109,101,47,105,110,100,101,120,46,109,106,115,58,49,48,54,49,58,49,55,41,34,44,34,32,32,32,32,97,116,32,97,115,121,110,99,32,85,115,101,114,70,117,110,99,116,105,111,110,46,106,115,46,109,111,100,117,108,101,46,101,120,112,111,114,116,115,46,108,111,97,100,32,40,102,105,108,101,58,47,47,47,118,97,114,47,114,117,110,116,105,109,101,47,105,110,100,101,120,46,109,106,115,58,49,48,57,51,58,50,49,41,34,44,34,32,32,32,32,97,116,32,97,115,121,110,99,32,115,116,97,114,116,32,40,102,105,108,101,58,47,47,47,118,97,114,47,114,117,110,116,105,109,101,47,105,110,100,101,120,46,109,106,115,58,49,50,53,54,58,50,51,41,34,44,34,32,32,32,32,97,116,32,97,115,121,110,99,32,102,105,108,101,58,47,47,47,118,97,114,47,114,117,110,116,105,109,101,47,105,110,100,101,120,46,109,106,115,58,49,50,54,50,58,49,34,93,125
@mrgrain mrgrain added sdk-v3-upgrade Tag issues that are associated to SDK V3 upgrade. Not limited to CR usage of SDK only. node18-upgrade Any work (bug, feature) related to Node 18 upgrade bug This issue is a bug. @aws-cdk/triggers Related to the triggers package labels Sep 12, 2023
@mrgrain mrgrain self-assigned this Sep 12, 2023
@mergify mergify bot closed this as completed in #27119 Sep 13, 2023
mergify bot pushed a commit that referenced this issue Sep 13, 2023
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*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

mikewrighton pushed a commit that referenced this issue Sep 14, 2023
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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/triggers Related to the triggers package bug This issue is a bug. node18-upgrade Any work (bug, feature) related to Node 18 upgrade sdk-v3-upgrade Tag issues that are associated to SDK V3 upgrade. Not limited to CR usage of SDK only.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant