Reputation: 101
When AWS Step-function fails, the output message is null and same is passed to cloudwatch event logs, but the error message in exception is not passed to cloudwatch events log. How can I send that exception message to cloudwatch events log so that I can process it downstream.
Upvotes: 2
Views: 1501
Reputation: 101
I ended up using below boto3.client(‘stepfunctions’) and then using get_execution_history() method to retrieve the cause and error.
Upvotes: 0
Reputation: 1194
CloudWatch Events and CloudWatch Logs are two different services. If you enable logging at ERROR
, FATAL
, or ALL
log level, you'll see the errors in CloudWatch Logs. See https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html
I assume you're referring to CloudWatch Events/EventBridge here. The events Step Functions emits to CloudWatch Events contain the result of the DescribeExecution API. It doesn't include errors, just the input and output of the execution. The error and cause that caused the execution to fail is in the executionFailedEventDetails
field of last event in the execution history. You can retrieve the last event by calling GetExecutionHistory with "reverseOrder": true
and "maxResults": 1
.
Upvotes: 1