lambda-cloudwatch-slack icon indicating copy to clipboard operation
lambda-cloudwatch-slack copied to clipboard

CodeDeploy alerts are missing information in Slack

Open andy-educake opened this issue 6 years ago • 0 comments

We have set up alerts on various CodeDeploy events to come via the lambda (great tool btw, thanks!) to a Slack channel. Unfortunately the Slack messages are missing most of the relevant detail. Screenshot 2020-05-05 at 11 56 15 Looking at the test data in the repo and comparing it to the actual event that came through from SNS it looks like the event's format might have changed. Compare test/sns-codedeploy-event.json with

{
    "Records": [
        {
            "EventSource": "aws:sns",
            "EventVersion": "1.0",
            "EventSubscriptionArn": "arn:aws:sns:eu-west-1:xxxxxxxx:name:uuid",
            "Sns": {
                "Type": "Notification",
                "MessageId": "uuid",
                "TopicArn": "arn:aws:sns:eu-west-1:xxxxxxxx:name",
                "Subject": null,
                "Message": "{\"version\":\"0\",\"id\":\"uuid\",\"detail-type\":\"CodeDeploy Deployment State-change Notification\",\"source\":\"aws.codedeploy\",\"account\":\"xxxxxxx\",\"time\":\"2020-05-05T09:53:00Z\",\"region\":\"eu-west-1\",\"resources\":[\"arn:aws:codedeploy:eu-west-1:xxxxxx:deploymentgroup:name/name\",\"arn:aws:codedeploy:eu-west-1:xxxxxx:application:name\"],\"detail\":{\"region\":\"eu-west-1\",\"deploymentId\":\"id\",\"instanceGroupId\":\"uuid\",\"deploymentGroup\":\"name\",\"state\":\"SUCCESS\",\"application\":\"name\"}}",
                "Timestamp": "2020-05-05T09:53:00.502Z",
                "SignatureVersion": "1",
                "Signature": "XXXXXXXXXXXXX",
                "SigningCertUrl": "https://sns.eu-west-1.amazonaws.com/cert.pem",
                "UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn",
                "MessageAttributes": {}
            }
        }
    ]
}

(data redacted to remove any sensitive info)

Am I right in thinking that the SNS payload has changed? In which case, I would be willing to do a PR to reflect these changes if that would help.

andy-educake avatar May 05 '20 11:05 andy-educake