-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(custom-resources): Provider function is throwing "Error: return values from user-handlers must be JSON objects. got: "" #26429
Comments
Logging the return as |
I do not have direct access to the onevent lambda code. The payload data is from the provider lambda's logs. |
I am also having this exact error. I am unable to upgrade our production system due to it. |
@jalvinake @mrlikl can you provide an example of what your handler is returning (I know you said you don't have access to the handler code is it a CR in aws-cdk-lib?)? I'm pretty sure we can just change the logic to something similar to the change we made in |
we recently migrated to cdkv2, Provider lambda errored with this return response object . Provider lambda used nodejs18 as runtime. Having issues specifically with this. |
The payload response of a Lambda used to be a `string`, and could occasionally be `""`, which we detected and special-case parsed to an empty object. In SDKv3, the payload response of a Lambda changed to type `Uint8Array`, but a `Uint8Array(0)` doesn't check as *falsey*, so we'd decode it to `""` and then the `JSON.parse()` of that would fail. First decode, then check the string for emptyness. Fixes #26429.
…t failure (#27000) The payload response of a Lambda used to be a `string`, and could occasionally be `""`, which we detected and special-case parsed to an empty object. The Payload should never be empty, and will only be that under exceptional circumstances which we haven't been able to pin down yet, but we shouldn't fail in any case. In SDKv3, the payload response of a Lambda changed to type `Uint8Array`, but a `Uint8Array(0)` doesn't check as *falsey*, so we'd decode it to `""` and then the `JSON.parse()` of that would fail. First decode, then check the string for emptyness. Fixes #26429.
|
…t failure (#27000) The payload response of a Lambda used to be a `string`, and could occasionally be `""`, which we detected and special-case parsed to an empty object. The Payload should never be empty, and will only be that under exceptional circumstances which we haven't been able to pin down yet, but we shouldn't fail in any case. In SDKv3, the payload response of a Lambda changed to type `Uint8Array`, but a `Uint8Array(0)` doesn't check as *falsey*, so we'd decode it to `""` and then the `JSON.parse()` of that would fail. First decode, then check the string for emptyness. Fixes #26429.
Describe the bug
Hello team,
I am seeing the error
Error: return values from user-handlers must be JSON objects. got: ""
recently while using theProvider
construct ofaws-cdk-lib/custom-resources
. Checking the cloudwatch logs of the request, I see that this is the return value sent back from the oneventhandler lambda fn.I see that there was a change recently in parseJsonPayload function from
const text = payload.toString();
tolet text = new TextDecoder().decode(Buffer.from(payload));
.Expected Behavior
Provider fn to return empty values/success
Current Behavior
Provider function is throwing "Error: return values from user-handlers must be JSON objects. got: ""
Reproduction Steps
Not sure of the reproduction steps here. Although I do not see any return from the event lambda.
This works fine if the return logged is "" like
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.87.0
Framework Version
No response
Node.js Version
18.16
OS
mac
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: