Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda Function #21

Closed
mitechniq opened this issue Mar 1, 2017 · 4 comments
Closed

Lambda Function #21

mitechniq opened this issue Mar 1, 2017 · 4 comments

Comments

@mitechniq
Copy link

mitechniq commented Mar 1, 2017

I am getting errors when running a test for both the SNS Notification and Slack Notification Lambda Functions.

NodeJS: START RequestId: 3978d1d4-fe10-11e6-b22e-073bd615aa3d Version: $LATEST 2017-02-28T23:47:15.226Z 3978d1d4-fe10-11e6-b22e-073bd615aa3d TypeError: Cannot read property '0' of undefined at exports.handler (/var/task/index.js:10:50)

Python: `TART RequestId: fb08727a-fe12-11e6-8e2d-e30405996e54 Version: $LATEST
"eventDescription": KeyError
Traceback (most recent call last):
File "/var/task/index.py", line 13, in handler
message = str(event['detail']['eventDescription'][0]['latestDescription'] + "

<https://phd.aws.amazon.com/phd/home?region=us-east-2#/event-log?eventID=" + event['detail']['eventArn'] + "|Click here> for details.")
KeyError: 'eventDescription'

@mwpatrick
Copy link
Contributor

What is the test event you are using for them look like?

@mitechniq
Copy link
Author

mitechniq commented Mar 1, 2017

I noticed there was no events posted in Slack, I decided to form an event in the Lambda Test section: { "account": "123456789", "region": "us-east-1", "detail": {}, "detail-type": "AWS Health Event", "source": "aws.health", "time": "1970-01-01T00:00:00Z", "id": "cdc73f9d-aea9-11e3-9d5a-835b769c0d9c", "resources": [ "arn:aws:events:us-east-1:123456789:rule/SlackNotifier-CloudWatchEventRule-GCBS8UOHBXM5" ] }

@tipuq
Copy link
Contributor

tipuq commented Mar 1, 2017

The error that you have shared above makes it seem like a field either doesn't exist or isn't in the right format. Have you tried the sample AWS Health CloudWatch events to see if it works? They can be accessed under the CloudWatch events console once you choose the Health service by clicking show sample events:
https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#rules:action=create

Here is an example of sample event that you could use to test your function:
{ "version": "0", "id": "7bf73129-1428-4cd3-a780-95db273d1602", "detail-type": "AWS Health Event", "source": "aws.health", "account": "123456789012", "time": "2016-06-05T06:27:57Z", "region": "us-west-2", "resources": [ "i-abcd1111" ], "detail": { "eventArn": "arn:aws:health:us-west-2::event/AWS_EC2_INSTANCE_STORE_DRIVE_PERFORMANCE_DEGRADED_90353408594353980", "service": "EC2", "eventTypeCode": "AWS_EC2_INSTANCE_STORE_DRIVE_PERFORMANCE_DEGRADED", "eventTypeCategory": "issue", "startTime": "Sat, 05 Jun 2016 15:10:09 GMT", "eventDescription": [ { "language": "en_US", "latestDescription": "A description of the event will be provided here" } ], "affectedEntities": [ { "entityValue": "i-abcd1111", "tags": { "stage": "prod", "app": "my-app" } } ] } }

@mitechniq
Copy link
Author

Thank you, it now works with a sample test but now I need to figure why the events are not being updated in CloudWatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants