seems trivial, but I can't get it to work: I'm sending data encoded as JSON objects to API Gateway which invokes Firehose. The resulting files in S3 contain all the JSON objects in a single line. I've read that it should be possible to add newlines, but whatever I try, there is either an error or it simply doesn't do anything. The mappping template looks like this
{
"DeliveryStreamName": "file-datadump",
"Record": {
"Data": "$util.base64Encode($input.json('$'))"
}
}
Any ideas what to do?
The answer is ridiculously easy. Simply add a line break like so in the mapping template.
#set($payload = "$input.json('$')
")
{
"DeliveryStreamName": "stream-name",
"Record": {
"Data": "$util.base64Encode($payload)"
}
}
NO LONGER CURRENT! - DO NOT USE
I was having the exact same issue. As per this helpful git issue, you can hack around it by appending a base64 encoded newline, example:
{
"DeliveryStreamName": "$stageVariables.delivery_stream",
"Record": {
"Data":"$util.base64Encode($input.params().querystring)Cg=="
}
}
It's not ideal, but hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With