aws / aws/aws-cdk

(aws-stepfunctions-tasks): Not possible to apply Aspects to Step Function tasks

Open
#23,596 5 comments 5 reactions 0 assignees View on GitHub
@aws-cdk/aws-stepfunctions-tasks bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

It is not possible to apply changes via `Aspects` on a Step Function `Task`.

### Expected Behavior

Should be possible to apply changes to tasks.

### Current Behavior

Any changes are ignored.

### Reproduction Steps

1. Make a state machine
2. Add a task to the definition
3. Apply aspects and add a retry, for example

### Possible Solution

Lazy evaluate?

### Additional Information/Context

This is happening because state machine definition is rendered to JSON inside the `StateMachine` constructor, thereby not giving a chance to Aspects to apply the changes.

https://github.com/aws/aws-cdk/blob/f178c98d4473d8bb8d46d80c076fa520d03c623b/packages/%40aws-cdk/aws-stepfunctions/lib/state-machine.ts#L410-L417

### CDK CLI Version

2.59.0 (build b24095d)

### Framework Version

2

### Node.js Version

v16.16.0

### OS

macOS

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts around lines 410-417, where the issue says the definition is rendered in the StateMachine constructor. Reproduce the reported state machine, task, and Aspect that adds a retry, then trace when the definition is rendered. Done means Aspect changes to Step Function tasks are applied rather than ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.