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

aws-stepfunctions-tasks: Default Retry policy for LambdaInvoke does not include "Lambda.ClientExecutionTimeoutException" #26470

Closed
andreiled opened this issue Jul 21, 2023 · 1 comment · Fixed by #26474
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@andreiled
Copy link

andreiled commented Jul 21, 2023

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

  1. Create a State Machine state to invoke a Lambda Function using the new LambdaInvoke() constructor without defining the retryOnServiceExceptions input parameter (i.e. leaving its default of true intact).
  2. 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

@andreiled andreiled added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 21, 2023
@mergify mergify bot closed this as completed in #26474 Jul 24, 2023
mergify bot pushed a commit that referenced this issue Jul 24, 2023
…s not include `Lambda.ClientExecutionTimeoutException` default Retry settings (#26474)

According to the document,  best practice for Step Functions which invoke a Lambda function is as follows.
https://docs.aws.amazon.com/step-functions/latest/dg/bp-lambda-serviceexception.html
```
"Retry": [ {
   "ErrorEquals": [ "Lambda.ClientExecutionTimeoutException", "Lambda.ServiceException", "Lambda.AWSLambdaException", "Lambda.SdkClientException"],
   "IntervalSeconds": 2,
   "MaxAttempts": 6,
   "BackoffRate": 2
} ]
```

I have made changes to align with the official documentation.

Closes #26470.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

bmoffatt pushed a commit to bmoffatt/aws-cdk that referenced this issue Jul 29, 2023
…s not include `Lambda.ClientExecutionTimeoutException` default Retry settings (aws#26474)

According to the document,  best practice for Step Functions which invoke a Lambda function is as follows.
https://docs.aws.amazon.com/step-functions/latest/dg/bp-lambda-serviceexception.html
```
"Retry": [ {
   "ErrorEquals": [ "Lambda.ClientExecutionTimeoutException", "Lambda.ServiceException", "Lambda.AWSLambdaException", "Lambda.SdkClientException"],
   "IntervalSeconds": 2,
   "MaxAttempts": 6,
   "BackoffRate": 2
} ]
```

I have made changes to align with the official documentation.

Closes aws#26470.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
1 participant