I\'m using AWS Lambda to scan data from a DynamoDB table. This is what I get in return:
{
\"videos\": [
{
\"fil
I know is a bit old but I had the same problem processing stream data from dynamoDB in node js lambda function. I used the proposed by @churro
import sdk and output converter
var AWS = require("aws-sdk");
var parse = AWS.DynamoDB.Converter.output;
use the parse function with a small hack
exports.handler = function( event, context, callback ) {
var docClient = new AWS.DynamoDB.DocumentClient();
event.Records.forEach((record) => {
console.log(record.eventID);
console.log(record.eventName);
console.log('DynamoDB Record:', parse({ "M": record.dynamodb.NewImage }));
});
callback(null, `Successfully processed ${event.Records.length} records.`);
}
Hope it helps