Created
April 23, 2020 19:35
-
-
Save digitalbase/2edf9d97d22a12e6f8d5db149d2ee775 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