aws / aws/aws-cdk

(stepfunctions): the service does not support JSON paths for MaxConcurrency on a Map state but CDK can generate one

Open
#20,835 3 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-stepfunctions bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the bug

Allowing JSON paths for `MaxConcurrency` was added in response to https://github.com/aws/aws-cdk/issues/20152, but JSON paths are not actually supported for the `MaxConcurrency` key in a `Map` state by Step Functions.

### Expected Behavior

I would expect synth to fail in the reproduction example.

### Current Behavior

Synth succeeds, but deploying fails with the following error:

```
11:31:04 AM | CREATE_FAILED | AWS::StepFunctions::StateMachine | StateMachine2E01A3A5
Resource handler returned message: "Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: Expected value of type Integer at /States/Map State/MaxConcurrency'"
```

### Reproduction Steps

```js
import { Duration, Stack, StackProps } from 'aws-cdk-lib';
import * as stepfunctions from 'aws-cdk-lib/aws-stepfunctions';
import { Construct } from 'constructs';

export class SfReproStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);

const map = new stepfunctions.Map(this, 'Map State', {
maxConcurrency: stepfunctions.JsonPath.numberAt('$.maxConcurrency'),
itemsPath: stepfunctions.JsonPath.stringAt('$.inputForMap'),
});
map.iterator(new stepfunctions.Pass(this, 'Pass State'));

const machine = new stepfunctions.StateMachine(this, "StateMachine", {
definition: map,
stateMachineName: 'ReproStateMachine',
timeout: Duration.minutes(5),
});
}
}
```

### Possible Solution

I think https://github.com/aws/aws-cdk/pull/20279 should be reverted until Step Functions supports this.

### Additional Information/Context

_No response_

### CDK CLI Version

2.28.1 (build d035432)

### Framework Version

_No response_

### Node.js Version

v18.4.0

### OS

macOS 12.3.1

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the TypeScript reproduction using Map.maxConcurrency and JsonPath.numberAt, then inspect the change from pull request 20279. Run synth for the example and verify that it rejects a JSON path for MaxConcurrency instead of producing a state machine definition that fails during deployment.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.