- Newest
- Most votes
- Most comments
hi,
to add the header value (source-system) to each record in your mapping template, the mapping template transformation fails.
can you share the CloudWatch "Unable to transform request" for detailed transformation error?
best
answered a year ago
hi,
means API Gateway couldn't parse your mapping template into valid JSON before sending to Firehose. Header value (source-system) gets injected into every record for firehose to see.
in you code with header--- raw JSON inside $util.base64Encode(...), but that function only accepts a string.
in you code :-
API Gateway fails transformation, hence Execution failed due to configuration error.
in API Gateway mapping templates - template for application/json.
try replacing header, like this: need to add the $util.toJson
{
"DeliveryStreamName": "<delivery_stream_name>",
"Records": [
#foreach($elem in $input.path('$'))
{
"Data": "$util.base64Encode($util.toJson({
\"source_system\": \"$input.params('source-system')\",
\"event\": $elem
}))"
}#if($foreach.hasNext),#end
#end
]
}
and than test API Gateway with header.
hope it helps, not sure if I was able to expressed it well. Best,
answered a year ago
Relevant content
asked a year ago

Hi,
I am getting this error only.
(7f5b4d90-069f-4a79-b7b1-630ec82ae1a0) Execution failed due to configuration error: Unable to transform request