CDK 2.15.0: Cannot get response field from custom resource #19685
-
Using cdk 2.15.0 I'am trying to create a lambda backed custom resource and get a field from its response but I get the following error:
I thought that the keys in the response of the lambda function must match the string parameter of custom_resource::.get_response_field which in that case would be "info.current". Am I wrong? Here is my code which is simplified and still produces the error. Feel free to replicate this: Note: There are some commented stuff that I am testing about the response being too large and utilizing the output_paths parameter which is also not working, but let's focus on my questions first.
And the lambda code:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey @manosntoulias, The So for your case, you're using Lambda Invoke. I'm not too sure what Hope this helps guide you in the right direction! |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hey @manosntoulias,
The
output_paths
parameter andgetResponseField
method both work with the Api response.For example, this custom resource is using the S3 listobjectsv2 API call. If we take a look at that call's response syntax, we can see how the response data will be returned. In this case, the example wants to only return the data seen in the first two objects in
Contents
, which is an array of Objects.So for your case, you're using Lambda Invoke. I'm not too sure what
info.current
is, but it's not in any of the response elements seen here 🙂Hope this helps guide you in the right direction!