Skip to content

Commit

Permalink
Merge pull request #29 from lux-group/ignore-unwanted-message-type
Browse files Browse the repository at this point in the history
ignore message type that we don't want
  • Loading branch information
shawn-cx-li authored Sep 15, 2020
2 parents 5fc21be + fb0372d commit 35178ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,13 @@ function getAttributes(body) {
const bodyJson = JSON.parse(body);
// handle s3 upload event
if (bodyJson.Records) return bodyJson.Records;
else if (bodyJson.MessageAttributes) {
// handle sns message
return mapAttributes(bodyJson);
}

return mapAttributes(bodyJson);
// do nothing if the message type it not what we need
return {};
}

function mapAttributes(data) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@luxuryescapes/lib-events",
"version": "1.0.28",
"version": "1.0.29",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/jest && yarn run lint",
Expand Down

0 comments on commit 35178ce

Please sign in to comment.