Search code examples
jsonfunctionamazon-web-servicesaws-lambdaaws-step-functions

AWS Step Function returns condition path references error


I am running step functions with two choices in AWS Step Functions.

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

choice state entered with this input

//ChoiceStateEntered

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

Error thrown

{
 "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."
}

Solution

  • Simply, you do not need $[0] but $. Per your input, you should use $.input instead of $[0].input