-
Notifications
You must be signed in to change notification settings - Fork 4.5k
aws-stepfunctions-tasks: Default Retry policy for LambdaInvoke does not include "Lambda.ClientExecutionTimeoutException" #26470
Description
Describe the bug
When using new LambdaInvoke() without disabling retryOnServiceExceptions, then the automatically created Retry configuration does not include the Lambda.ClientExecutionTimeoutException error type.
Expected Behavior
Default Retry configuration created by new LambdaInvoke() should include the "Lambda.ClientExecutionTimeoutException" error type [in addition to the 3 error types that are already in there] following the most recent recommendation in AWS Step Functions / Handle Lambda service exceptions.
{
"ErrorEquals": [ "Lambda.ClientExecutionTimeoutException", "Lambda.ServiceException", "Lambda.AWSLambdaException", "Lambda.SdkClientException"],
"IntervalSeconds": 2,
"MaxAttempts": 6,
"BackoffRate": 2
}Current Behavior
Default Retry configuration created by new LambdaInvoke() contains the following 3 error types: "Lambda.ServiceException", "Lambda.AWSLambdaException", "Lambda.SdkClientException" - which appears to follow an older version of the recommendation in AWS Step Functions / Handle Lambda service exceptions.
{
"ErrorEquals": [ "Lambda.ServiceException", "Lambda.AWSLambdaException", "Lambda.SdkClientException"],
"IntervalSeconds": 2,
"MaxAttempts": 6,
"BackoffRate": 2
}Reproduction Steps
- Create a State Machine state to invoke a Lambda Function using the
new LambdaInvoke()constructor without defining theretryOnServiceExceptionsinput parameter (i.e. leaving its default oftrueintact). - Build and review generated Retry configuration for the state (e.g. in the generated CloudFormation tempalte file, or can deploy to an AWS account and review the configuration there).
Possible Solution
Add 'Lambda.ClientExecutionTimeoutException' to the errors array defined on this line of the LambdaInvoke constructor in aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/invoke.ts.
Additional Information/Context
While the AWS CDK documentation section describing the retryOnServiceExceptions constructor parameter of LambdaInvoke (link) mentions explicitly only the 3 particular error types covered by the default Retry configuration at this time, that same section also references the AWS Step Functions / Handle Lambda service exceptions documentation that recommends including the Lambda.ClientExecutionTimeoutException error in that Retry configuration as well.
My best guess is that the inclusion of the Lambda.ClientExecutionTimeoutException error into the above recommendation fairly recent (I have a strong feeling it was not there couple months ago) and did not yet make its way to AWS CDK.
CDK CLI Version
3.87.0 (build 9fca790)
Framework Version
No response
Node.js Version
14.x
OS
Amazon Linux 2
Language
Typescript
Language Version
No response
Other information
No response