aws-stepfunctions-tasks: resultSelector keys with null values are dropped when building CDK
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
While a raw step function JSON definition, I'm able to set up a Lambda-executing task step which includes these attributes. The step works as expected, running the lambda and providing the static output.
```
"ResultPath": "$",
"ResultSelector": {
"resultKey": null
}
```
But when trying to create CDK which generates the same JSON definition, key/value pairs in the result selector which have a null value are removed entirely. This creates a gap in what is possible from a step function created via CDK.
### Expected Behavior
Creating a task state using this CDK:
```
new LambdaInvoke(scope, id, {
// irrelevant props left out of example
resultPath: "$",
resultSelector: {
resultKey: null
}
})
```
Should produce a task with these attributes in the JSON definition.
```
"ResultPath": "$",
"ResultSelector": {
"resultKey": null
}
```
### Current Behavior
Creating a task state using this CDK:
```
new LambdaInvoke(scope, id, {
// irrelevant props left out of example
resultPath: "$",
resultSelector: {
resultKey: null
}
})
```
Silently produces a task with these attributes in the JSON definition.
```
"ResultPath": "$",
"ResultSelector": {}
```
For an additional demonstration, this CDK:
```
new LambdaInvoke(scope, id, {
// irrelevant props left out of example
resultPath: "$",
resultSelector: {
resultKeyNullValue: null,
resultKeyWithValue: "value"
}
})
```
Silently produces a task with these attributes in the JSON definition.
```
"ResultPath": "$",
"ResultSelector": {
"resultKeyWithValue": "value"
}
```
### Reproduction Steps
Build CDK which contains this step in a state machine
```
new LambdaInvoke(scope, id, {
// irrelevant props left out of example
resultPath: "$",
resultSelector: {
resultKey: null
}
})
```
And view the step function JSON in the produced cloud formation template to check if `"resultKey": null` exists.
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.59
### Framework Version
_No response_
### Node.js Version
14
### OS
macOS 12.6.1
### Language
Typescript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start by reproducing the LambdaInvoke resultSelector case in a CDK stack and inspect the generated CloudFormation template. Trace how resultSelector is rendered, then verify that entries with null values remain in the ResultSelector output alongside non-null entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100