简体   繁体   中英

pass output of step function one trigger to next trigger in AWS

I am trying to pass output of 1st trigger as input to my lambda function. After code run i am not able to see my lambda function is called. Although I seen that Input of 2nd step function is taken as string as it is. It is not passing actual value. please see below image. Input & Output for 2nd trigger

在此处输入图像描述

    {
  "Comment": "A description of my state machine",
  "StartAt": "Pass",
  "States": {
    "Pass": {
      "Type": "Pass",
      "Result": {
        "method": "GET",
        "body": "SELECT * from TestTable"
      },
      "ResultPath": "$.latest",
      "OutputPath": "$.latest",
      "Next": "NextPass"
    },
    "NextPass": {
       "Type": "Task",
      "Resource": "arn:aws:lambda:<location>:<key>:function:<function-Name>",
      "Parameters": {
        "method": "$.latest.method",
        "body": "$.latest.body"
      },
      "End": true
    }
  }
}

To access the data from the input, you need to add ".$" to the end of the Parameter names. This tells Step Functions that you're reading from a JSON path.

So your code should look like the following snippet below:

"Parameters": {
  "method.$": "$.latest.method",
  "body.$": "$.latest.body"
}

Hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM