Skip to content

Commit

Permalink
feat(aws-stepfunctions): add support to heartbeat error inside catch …
Browse files Browse the repository at this point in the history
…block (#16078)

Step Functions recently added a feature to catch States.HeartbeatTimeout. This change adds support to that.

https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html

closes #16084

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
diegotry authored Aug 18, 2021
1 parent f35b032 commit 2372b3c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/@aws-cdk/aws-stepfunctions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,22 @@ new cloudwatch.Alarm(this, 'ThrottledAlarm', {
});
```

## Error names

Step Functions identifies errors in the Amazon States Language using case-sensitive strings, known as error names.
The Amazon States Language defines a set of built-in strings that name well-known errors, all beginning with the `States.` prefix.

* `States.ALL` - A wildcard that matches any known error name.
* `States.Runtime` - An execution failed due to some exception that could not be processed. Often these are caused by errors at runtime, such as attempting to apply InputPath or OutputPath on a null JSON payload. A `States.Runtime` error is not retriable, and will always cause the execution to fail. A retry or catch on `States.ALL` will NOT catch States.Runtime errors.
* `States.DataLimitExceeded` - A States.DataLimitExceeded exception will be thrown for the following:
* When the output of a connector is larger than payload size quota.
* When the output of a state is larger than payload size quota.
* When, after Parameters processing, the input of a state is larger than the payload size quota.
* See [the AWS documentation](https://docs.aws.amazon.com/step-functions/latest/dg/limits-overview.html) to learn more about AWS Step Functions Quotas.
* `States.HeartbeatTimeout` - A Task state failed to send a heartbeat for a period longer than the HeartbeatSeconds value.
* `States.Timeout` - A Task state either ran longer than the TimeoutSeconds value, or failed to send a heartbeat for a period longer than the HeartbeatSeconds value.
* `States.TaskFailed`- A Task state failed during the execution. When used in a retry or catch, `States.TaskFailed` acts as a wildcard that matches any known error name except for `States.Timeout`.

## Logging

Enable logging to CloudWatch by passing a logging configuration with a
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-stepfunctions/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export class Errors {
*/
public static readonly ALL = 'States.ALL';

/**
* A Task State failed to heartbeat for a time longer than the “HeartbeatSeconds” value.
*/
public static readonly HEARTBEAT_TIMEOUT = 'States.HeartbeatTimeout';

/**
* A Task State either ran longer than the “TimeoutSeconds” value, or
* failed to heartbeat for a time longer than the “HeartbeatSeconds” value.
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-stepfunctions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"awslint": {
"exclude": [
"duration-prop-type:@aws-cdk/aws-stepfunctions.Errors.TIMEOUT",
"duration-prop-type:@aws-cdk/aws-stepfunctions.Errors.HEARTBEAT_TIMEOUT",
"no-unused-type:@aws-cdk/aws-stepfunctions.ServiceIntegrationPattern"
]
},
Expand Down

0 comments on commit 2372b3c

Please sign in to comment.