-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
@aws-cdk/aws-stepfunctionsRelated to AWS StepFunctionsRelated to AWS StepFunctionsbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp2
Description
Describe the bug
When creating a CustomState within a state machine, and specifying the retry behaviour within the inline definition, we get back an error saying state.Retry is not iterable. However, adding the retry behaviour separately with .addRetry seems to fix this issue. I strongly suspects this is linked to the following PR #28793
Expected Behavior
The state machine should create successfully
Current Behavior
Throws
TypeError: state.Retry is not iterable
at CustomState.toStateJson
Reproduction Steps
Creating a state machine with the following state
const myLambdaState: sfn.CustomState = new sfn.CustomState(this, 'Call Lambda', {
stateJson: {
Type: "Task",
Resource: "arn:aws:states:::lambda:invoke",
OutputPath: "$.Payload",
Parameters: {
'Payload.$': "$",
"FunctionName": "arn:aws:lambda:us-east-1:<<ACCOUNT>>:function:print1:$LATEST"
},
Retry: [
{
"ErrorEquals": [
"Lambda.ServiceException",
"Lambda.AWSLambdaException",
"Lambda.SdkClientException",
"Lambda.TooManyRequestsException"
],
"IntervalSeconds": 1,
"MaxAttempts": 3,
"BackoffRate": 2
}
],
Catch: [
{
ErrorEquals: [
"States.ALL"
],
Next: "fail.id"
}
]
,
}
});
However, doing the following works:
const success: sfn.Succeed = new sfn.Succeed(this, 'Success Name');
const fail: sfn.Fail = new sfn.Fail(this, 'Fail Name');
const myLambdaState: sfn.CustomState = new sfn.CustomState(this, 'Call Lambda', {
stateJson: {
Type: "Task",
Resource: "arn:aws:states:::lambda:invoke",
OutputPath: "$.Payload",
Parameters: {
'Payload.$': "$",
"FunctionName": "arn:aws:lambda:us-east-1:<<ACCOUNT-ID>>:function:print1:$LATEST"
}
}
});
myLambdaState.addRetry({
maxAttempts: 1,
maxDelay: cdk.Duration.seconds(5),
jitterStrategy: sfn.JitterType.FULL,
});
myLambdaState.addCatch(fail, {
errors: ['States.ALL']
}
)
myLambdaState.next(success);
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.128.0
Framework Version
No response
Node.js Version
v21.6.2
OS
Mac 14.3.1
Language
TypeScript
Language Version
No response
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-stepfunctionsRelated to AWS StepFunctionsRelated to AWS StepFunctionsbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp2