Simple AWS lambda that runs every 5 minutes and reports all AWS X-Ray exceptions for the last 5 minutes to a specified Slack channel.
- Create a Slack app (https://api.slack.com/slack-apps)
- Add the app to your workspace and add
chat:write:bot
permission - Clone the repo and install dependencies by running either
yarn
ornpm i
. - Put your oAuth access token and channel id to the respective environment variables in the
serverless.yml
file - Make sure you have the correct region set in the
serverless.yml
. It will only report exceptions from the same region. - Run
sls deploy
. If you don't have Serverless cli installed, use following npm command to install it:
npm install -g serverless
- The lambda will only report exceptions from AWS X-Ray in the same AWS region it is deployed.
- It will also only report exceptions that are reported in a segment. It will not report exceptions from subsegments. To do that you'll need to modify the
extractExceptions
function to recursively traverse segments tree.