[aws-events] API Destination Input Transformer missing quotes #31451
Unanswered
sethgeoghegan
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hey @sethgeoghegan have you ever found a solution/workaround for this? I'm facing the same situation. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem Summary
I have an EventBridge event that I want to send to an API Destination target. The Input Transformer generated by CDK is not quoting strings, which is resulting in invalid JSON in the API request made by the API Destination.
I am assuming this is not a bug, but a misunderstanding on my behalf on how the CDK constructs are meant to be used.
Details
The EventBridge payload looks like this
I want to transform this event into an API request to
https://someapi.com/
with thedetail.ended_at
field passed in the body of the API request. In pseudocode:I'm creating an API Destination and Input Transformer as follows:
This creates an Input Transformer that does not escape the
ended_at
field with quotes, which results in invalid JSON.I can manually update the Template in the AWS Console, which results in the valid JSON output I'm looking for:
However, I cannot figure out how to use CDK to generate a template that includes quotes around the value of
$.detail.ended_at
. However, I've gotten rather close with this attempt:Which output the following. The
timestamp
field lacks any quotes and is invalid JSON.timestamp2
has aTEST
prefix, which is also not what I want.Beta Was this translation helpful? Give feedback.
All reactions