arabold / aws-to-slack

Forward AWS CloudWatch Alarms and other notifications from Amazon SNS to Slack.
MIT License
294 stars 111 forks source link

Error rendering chart #74

Closed lkolchin closed 5 years ago

lkolchin commented 5 years ago

Deploying using serverless and nodejs10.x and getting this in the lambda logs:

2019-08-31T12:56:28.141Z cd3c3e52-1260-4878-82bd-18b7b66dfeb7 INFO Error rendering chart: { InvalidParameterValue: The parameter Statistics.member.1 must be a value in the set [ Minimum, Maximum, Average, SampleCount, Sum ]. at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/query.js:50:29) at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20) at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10) at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14) at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12) at /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9) at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:685:12) at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:116:18) message: 'The parameter Statistics.member.1 must be a value in the set [ Minimum, Maximum, Average, SampleCount, Sum ].', code: 'InvalidParameterValue', time: 2019-08-31T12:56:28.125Z, requestId: 'c7c77eed-a0bc-4714-b2b5-c651316e7e8e', statusCode: 400, retryable: false, retryDelay: 19.789864084998786 }

Any idea what the problem is?

lkolchin commented 5 years ago

Looking at the charts.js code and it looks like SampleCount is not supported :(

homeyjd commented 5 years ago

Event is parsed: https://github.com/arabold/aws-to-slack/blob/master/src/parsers/cloudwatch/index.js#L88 Query is formatted for API: https://github.com/arabold/aws-to-slack/blob/master/src/parsers/cloudwatch/chart.js#L540 And is sent to API: https://github.com/arabold/aws-to-slack/blob/master/src/parsers/cloudwatch/chart.js#L199

SampleCount should work if we just fix the capitalization. https://github.com/arabold/aws-to-slack/commit/e45be0f465ae6b335f3f5138b16522e8cac68c21