AWS Step Function返回条件路径引用错误

时间:2017-10-27 03:18:27

标签: json function amazon-web-services aws-lambda aws-step-functions

我在AWS步骤函数中运行两个选项的步骤函数。

...
"ChoiceState": {
  "Type" : "Choice",
  "Choices": [
    {
      "Variable": "$[0].input",
      "NumericEquals":1,
      "Next": "FirstMatchState"
    },
    {
      "Variable": "$[0].input",
      "NumericEquals":2,
      "Next": "SecondMatchState"
    }
  ],
  "Default": "DefaultState"
},
...

使用此输入输入的选择状态

//ChoiceStateEntered

{
"name": "ChoiceState",
"input": 1
}

抛出错误

{
 "error": "States.Runtime",
 "cause": "An error occurred while executing the state 'ChoiceState'      (entered at the event id #7). Invalid path '$[0].input': The choice state's condition path references an invalid value."
}

1 个答案:

答案 0 :(得分:1)

简单地说,你不需要$ [0]而是$。根据您的输入,您应该使用$ .input而不是$ [0] .input