assertible / lambda-cloudwatch-slack

Send AWS CloudWatch notifications to a Slack channel using Lambda
https://assertible.com/blog/npm-package-lambda-cloudwatch-slack
MIT License
485 stars 255 forks source link

SyntaxError: Unexpected token T #24

Open woodland-appcolony opened 7 years ago

woodland-appcolony commented 7 years ago

Looks like a great lambda implementation, would love to use it, but it seems to be doing something odd.

First, Lambda's default SNS test event causes this failure:

2017-11-28T19:37:15.286Z    1a21cdd9-d473-11e7-89a1-a3392781a961    SyntaxError: Unexpected token T
at Object.parse (native)
at handleCatchAll (/var/task/index.js:282:24)
at processEvent (/var/task/index.js:347:20)
at exports.handler (/var/task/index.js:370:5)

Second, I sent Elastic Beanstalk events through SNS to this Lambda code, and strangely enough it was being handled by the catch-all, not the Elastic Beanstalk handler.

And, those Beanstalk events would fail with the exact same error above.

JeroenRijks commented 4 years ago

Hey @woodland-appcolony , I know this was two and a half years ago, but I'm running into the same issue, only with EC2 events through SNS, instead of Elastic Beanstalk. Did you figure out what the issue is?

Edit: It seems like this issue occurs when the SNS topic requires encryption (using the SSE key), because you can't set CloudWatch up to encrypt its own messages using the SSE KMS key.

Workaround is to either create a KMS key that Cloudwatch can use, or to not encrypt your SNS topic