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: Retry in statesJson no longer appears in StateMachine definition #28769

Closed
jacklin213 opened this issue Jan 19, 2024 · 1 comment · Fixed by #28793
Closed
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@jacklin213
Copy link
Member

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

@jacklin213 jacklin213 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 19, 2024
@github-actions github-actions bot added the @aws-cdk/aws-stepfunctions Related to AWS StepFunctions label Jan 19, 2024
@pahud pahud added p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 20, 2024
@mergify mergify bot closed this as completed in #28793 Feb 1, 2024
mergify bot pushed a commit that referenced this issue Feb 1, 2024
…is always overwrited (#28793)

After #28422 was merged, the regression that overwrites the Retry field defined in the stateJson was introduced.
The `this.renderRetryCatch()` method overwrites the Retry field in the stateJson.
https://github.com/aws/aws-cdk/blob/45b8398bec9ba9c03f195c14f3b92188c9058a7b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/custom-state.ts#L74

This PR fixes this regression and clarifies the current behavior for configuring the Retry and Catch field.

Previously, I added the `addRetry` method to add the Retry field and did not render the Retry field in the stateJson in #28598, but this is initially a regression and should have been fixed.

Closes #28769
Relates #28586

----

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

github-actions bot commented Feb 1, 2024

⚠️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.

SankyRed pushed a commit that referenced this issue Feb 8, 2024
…is always overwrited (#28793)

After #28422 was merged, the regression that overwrites the Retry field defined in the stateJson was introduced.
The `this.renderRetryCatch()` method overwrites the Retry field in the stateJson.
https://github.com/aws/aws-cdk/blob/45b8398bec9ba9c03f195c14f3b92188c9058a7b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/custom-state.ts#L74

This PR fixes this regression and clarifies the current behavior for configuring the Retry and Catch field.

Previously, I added the `addRetry` method to add the Retry field and did not render the Retry field in the stateJson in #28598, but this is initially a regression and should have been fixed.

Closes #28769
Relates #28586

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TheRealAmazonKendra pushed a commit that referenced this issue Feb 9, 2024
…is always overwrited (#28793)

After #28422 was merged, the regression that overwrites the Retry field defined in the stateJson was introduced.
The `this.renderRetryCatch()` method overwrites the Retry field in the stateJson.
https://github.com/aws/aws-cdk/blob/45b8398bec9ba9c03f195c14f3b92188c9058a7b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/custom-state.ts#L74

This PR fixes this regression and clarifies the current behavior for configuring the Retry and Catch field.

Previously, I added the `addRetry` method to add the Retry field and did not render the Retry field in the stateJson in #28598, but this is initially a regression and should have been fixed.

Closes #28769
Relates #28586

----

*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 Related to AWS StepFunctions bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
2 participants