aws / aws/aws-cdk

(CustomState): (adding Parallel stage inside distributed map doesn't work)

Open
#24,769 1 comment 3 reactions 0 assignees View on GitHub
@aws-cdk/aws-stepfunctions bug effort/medium p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

using the `aws_stepfunctions.CustomState` I tried to create one distributed map.
Inside map, i tried to add Parallel state with two branches.
But during the deployment, I am getting error - `Parallel must have at list one branch`

while printing Parallel object with `to_state_json`, i get empty list.
Kindly note, When i try same Parallel code without CustomState then its work fine but inside CustomState, unfortunately not.

### Expected Behavior

it should return correct branch list.
### Current Behavior

I receive error - Parallel must have at least one branch

### Reproduction Steps

parallel = sfn.Parallel(self, 'parent')

branch_1 = sfn.Pass(self, 'child_1')
branch_2 = sfn.Pass(self, 'child_2')
branch_3 = sfn.Pass(self, 'child_3')
parallel = parallel.branch(branch_1).branch(branch_2).branch(branch_3)

state_json = {
"Type": "Map",
"Label": "Map",
"End": True,
"MaxConcurrency": 5,
"ItemProcessor": {
"ProcessorConfig": {
"Mode": "DISTRIBUTED",
"ExecutionType": "STANDARD"
},
"StartAt": "Parallel",
"States": {
"Parallel": parallel.to_state_json()
}
}
}

definition = sfn.CustomState(
scope=self,
id='aws_distributed_map',
state_json=state_json
)

state_machine = sfn.StateMachine(self, id=state_machine_identity, definition=definition)

### Possible Solution

_No response_

### Additional Information/Context

Might `to_state_json` is creating problem

### CDK CLI Version

2.70.0 (build c13a0f1)

### Framework Version

_No response_

### Node.js Version

v16.16.0

### OS

MacOs

### Language

Python

### Language Version

3.9

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the CustomState and Parallel.to_state_json() entry points described in the reproduction, then run the distributed Map example and inspect the synthesized state machine definition. Done means the nested Parallel state preserves its branch list and deployment no longer reports that it has no branches.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.