Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RunLambdaTask with outputPath not working

See original GitHub issue

outputPath when used with RunLambdaTask is not working as documented. In the step functions overview under Lambda example

“The following snippet invokes a Lambda and sets the task output to only include the Lambda function response.”

new sfn.Task(this, 'Invoke and set function response as task output', {
  task: new tasks.RunLambdaTask(myLambda, {
    payload: sfn.TaskInput.fromDataAt('$'),
  outputPath: '$.Payload',

Reproduction Steps

Starting from a working tasks.InvokeFunction:

minimal amount of code that causes the bug (if possible) or a reference:

         const getObject = new sfn.Task(this, "Get Object", {
-            task: new tasks.RunLambdaTask(getObjectLambda, {}),
-            outputPath: "$.Payload",
+            task: new tasks.InvokeFunction(getObjectLambda, {}),
             resultPath: "$.GetObjectResult",

Also tried outputPath: “$.output.Payload” with same result.

Error Log

TaskSucceeded with:

  "resourceType": "lambda",
  "resource": "invoke",
  "output": {
    "ExecutedVersion": "$LATEST",
    "Payload": {
      "Done": true,
      "Next": null,
      "BitsFetched": 0
    "SdkHttpMetadata": {
      "HttpHeaders": {
        "Connection": "keep-alive",
        "Content-Length": "41",
        "Content-Type": "application/json",
        "Date": "Thu, 30 Apr 2020 00:36:36 GMT",
        "X-Amz-Executed-Version": "$LATEST",
        "x-amzn-Remapped-Content-Length": "0",
        "x-amzn-RequestId": "f1e1c5df-4740-4389-8230-2c495c5cd829",
        "X-Amzn-Trace-Id": "root=1-5eaa1d94-16cf39fcb6ea5d8bb11bd635;sampled=0"
      "HttpStatusCode": 200
    "SdkResponseMetadata": {
      "RequestId": "f1e1c5df-4740-4389-8230-2c495c5cd829"
    "StatusCode": 200

followed by `ExecutionFailed` with:

  "error": "States.Runtime",
  "cause": "An error occurred while executing the state 'Get Object' (entered at the event id #2). Invalid path '$.Payload' : No results for path: $['Payload']"


### Environment

  - **CLI Version      :** 1.36.1
  - **Framework Version:** 1.36.1
  - **OS               :** macOS Catalina 10.15.5 Beta (19F62f)
  - **Language         :** Typescript

### Other

<!-- e.g. detailed explanation, stacktraces, related issues, suggestions on how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc -->


This is :bug: Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

shivlakscommented, Jul 23, 2020

In #9022 we introduced a flag payloadResponseOnly to the LambdaInvoke class which succeeded RunLambdaTask to request the legacy behaviour where Lambda’s function result only is the state output and no other metadata is included.

The legacy Lambda integration with Step Functions does not support callbacks (.sync) and is request response only. It does offer the benefit of a simpler experience for users that just want Lambda’s results to become the state output and for the Lambda to run synchronously.

eikeoncommented, May 1, 2020

Yep; the addition of a few .Payloads elsewhere in my step functions and no need for workarounds. So maybe just a note along side the deprecated notice of InvokeFunction of what options lie ahead. If I would have started with RunLambdaFunction I would not have been trying to preserve that exact behavior so hard

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws step function choice invalid path - Stack Overflow
OutputPath is used to only pass a portion of the result on to the next step. So your previous state machine was looking...
Read more >
Converting an AWS Step Function to use CDK - Part 1
The key bit I was missing is below: "The OutputPath is computed after applying ResultPath. All service integrations return metadata as part of ......
Read more >
awslabs/aws-cdk - Gitter
When i use InvokeFunction there are not problems. The input is available in lambda with no problems. But if i start using RunLambdaTask...
Read more >
class LambdaInvoke (construct) · AWS CDK
Invocation type of the Lambda function. outputPath? string, JSONPath expression to select select a portion of the state output to pass to the...
Read more >
将AWS Step Function 转换为使用CDK - 第1 部分_云O生
这不是我所期望的,但是通过使用函数上的 outputPath 属性来选择 Payload ... 年4 月开始出现以下问题:RunLambdaTask with outputPath not working.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found