Skip to content

aws-stepfunctions: Retry in statesJson no longer appears in StateMachine definition #28769

@jacklin213

Description

@jacklin213

Describe the bug

As called out in #28586. Prior to v2.115.0 If the user had a Retry block defined within the statesJson object passed to sfn.CustomState, the resulting State Machine definition would contain the retry block.

However since v2.116.0 this is no longer the case.

Although in #28598, an addRetry function was added which allows users to define a retry block after the CustomState is created. The regression introduced in v2.116.0 is not fixed, and there is no documentation advising customers to move to using addRetry instead (If this regression cannot be fixed)

Expected Behavior

The Retry block within statesJson passed to CustomState in the constructor should appear in the resulting State Machine definition as observed in versions 2.115.0 and before

Current Behavior

Users that previously had the Retry block defined during instantiation time of CustomState will find that their State Machined definitions now no longer have a Retry block

Reproduction Steps

const stateJson = {
    Type: 'Task',
    Resource: 'arn:aws:states:::lambda:invoke.waitForTaskToken',
    ResultPath: '$',
    Parameters: {
        Payload: {
            'TASK_TOKEN.$': '$$.Task.Token',
            'INPUT_FOR_TASK.$': '$'
        },
        'FunctionName.$': '$.lambdaFunctionName'
    },
    Retry: [
        {
            ErrorEquals: [
                'Lambda.ServiceException',
                'Lambda.AWSLambdaException',
                'Lambda.SdkClientException',
                'Lambda.TooManyRequestsException'
            ],
            IntervalSeconds: 1,
            MaxAttempts: 3,
            BackoffRate: 2
        }
    ],
    End: true,
    Comment: 'Lambda invoker for test runs'
};

const RunTaskState = new sfn.CustomState(this, 'LambdaRunTask.', {
    stateJson: stateJson
});

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.121.1

Framework Version

No response

Node.js Version

v18.18.2

OS

Amazon Linux 2

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-stepfunctionsRelated to AWS StepFunctionsbugThis issue is a bug.effort/mediumMedium work item – several days of effortp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions