Created
April 23, 2020 19:34
-
-
Save digitalbase/4988a0ff9dd57a64778718b666acece7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // /src/utils/dynamo_stream.util.js | |
| const AWS = require('aws-sdk'); | |
| const unmarshallNewImageEvent = (eventData) => { | |
| if (!eventData.dynamodb) { | |
| throw new Error('Not a dynamo event'); | |
| } | |
| // if you want the raw event we need to unmarshall it | |
| // more @ https://stackoverflow.com/questions/44535445/unmarshall-dynamodb-json | |
| return AWS.DynamoDB.Converter.unmarshall(eventData.dynamodb.NewImage); | |
| }; | |
| module.exports = { | |
| unmarshallNewImageEvent | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment