diff --git a/aws-node-github-webhook-listener/handler.js b/aws-node-github-webhook-listener/handler.js index fd25a220d..1f3a760d0 100644 --- a/aws-node-github-webhook-listener/handler.js +++ b/aws-node-github-webhook-listener/handler.js @@ -11,7 +11,8 @@ module.exports.githubWebhookListener = (event, context, callback) => { const sig = headers['X-Hub-Signature']; const githubEvent = headers['X-GitHub-Event']; const id = headers['X-GitHub-Delivery']; - const calculatedSig = signRequestBody(token, JSON.stringify(event.body)); + const calculatedSig = signRequestBody(token, event.body); + const eventObj = JSON.parse(event.body); if (typeof token !== 'string') { errMsg = '[401] must provide a \'GITHUB_WEBHOOK_SECRET\' env variable'; @@ -40,7 +41,7 @@ module.exports.githubWebhookListener = (event, context, callback) => { /* eslint-disable */ console.log('---------------------------------'); - console.log(`Github-Event: "${githubEvent}" with action: "${event.body.action}"`); + console.log(`Github-Event: "${githubEvent}" with action: "${eventObj.action}"`); console.log('---------------------------------'); console.log('Payload', event.body); /* eslint-enable */