Passthrough input to output in AWS Step Functions

For those who find themselves here using CDK, the solution is to use the explicit aws_stepfunctions.JsonPath.DISCARD enum rather than None/null.

from aws_cdk import (
    aws_stepfunctions,
    aws_stepfunctions_tasks,
)

aws_stepfunctions_tasks.LambdaInvoke(
    self,
    "my_function",
    lambda_function=lambda_function,
    result_path=aws_stepfunctions.JsonPath.DISCARD,
)

https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-stepfunctions.JsonPath.html#static-discard


In the Amazon States Language spec it is stated that:

If the value of ResultPath is null, that means that the state’s own raw output is discarded and its raw input becomes its result.

Consequently, I updated my state definition to

"First State": {
    "Type": "Task",
    "Resource": "[My Lambda ARN]",
    "Next": "Second State",
    "ResultPath": null
}

As a result, when passing the input example Task input payload will be copied to the output, even for rich objects like:

{
    "firstKey": "firstValue",
    "secondKey": "secondValue"
}