aws / aws/aws-cdk

aws_stepfunctions_tasks: payloadResponseOnly cannot be used with TaskInput.fromJsonPathAt

Open
#34,260 1 comment 0 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

@jakubknejzlik Described the issue perfectly here in a now closed issue:
https://github.com/aws/aws-cdk/issues/22390#issuecomment-1996739024
(Copied for visibility)

> CDK code:
> ```
> new LambdaInvoke(scope, id, {
> lambdaFunction: ...,
> payload: TaskInput.fromJsonPathAt("$.input"),
> payloadResponseOnly: true,
> })
> ```
> produces following definition:
> ```
> "state": {
> ...
> "Type": "Task",
> "Resource": "arn:aws:lambda:{region}:{account}:function:{function_name}",
> "Parameters": "$.input" // this is the problem
> }
> ```
> When payloadResponseOnly: false it produces following definition:
> ```
> "state": {
> ...
> "Type": "Task",
> "Resource": "arn:aws:states:::lambda:invoke",
> "Parameters": {
> "FunctionName": "arn:aws:lambda:{region}:{account}:function:{function_name}",
> "Payload.$": "$.input"
> }
> }
> ```
> When I use TaskInput.fromObject like so:
> ```
> new LambdaInvoke(scope, id, {
> lambdaFunction: ...,
> payload: TaskInput.fromObject({
> input: JsonPath.stringAt("$.input"),
> }),
> payloadResponseOnly: true,
> })
> ```
> The definition is ok:
> ```
> "state": {
> ...
> "Type": "Task",
> "Resource": "arn:aws:lambda:{region}:{account}:function:{function_name}",
> "Parameters": {
> "input.$": "$.input"
> }
> }
> ```

And another closed issue:
https://github.com/aws/aws-cdk/issues/23996

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Version

_No response_

### Expected Behavior

See above

### Current Behavior

See above

### Reproduction Steps

See above

### Possible Solution

See above

### Additional Information/Context

_No response_

### CDK CLI Version

2.1012.0

### Framework Version

_No response_

### Node.js Version

22.15.0

### OS

MacOS

### Language

Python

### Language Version

3.10

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the aws_stepfunctions_tasks LambdaInvoke entry point and the TaskInput.fromJsonPathAt behavior described in the reproduction. Compare the generated state definition for payloadResponseOnly with a JSON-path payload against the working fromObject example. Done means the JSON-path form produces a valid direct Lambda task definition when payloadResponseOnly is true.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.