From db7b9fec152a4c449120cf131e32b0e5ca7e5a19 Mon Sep 17 00:00:00 2001 From: Shawn LI Date: Tue, 15 Sep 2020 14:03:32 +1000 Subject: [PATCH 1/2] ignore message type that we don't want --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f262897..3a7b2f5 100644 --- a/index.js +++ b/index.js @@ -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) { From fb0372d378b8493969dd9dce066264d1c5892d43 Mon Sep 17 00:00:00 2001 From: Shawn LI Date: Tue, 15 Sep 2020 14:07:59 +1000 Subject: [PATCH 2/2] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0f99f39..756f6dc 100644 --- a/package.json +++ b/package.json @@ -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",