AWS step function giving error, when I had included the "Parameter" tag

0

I am trying to run the below step function code. It gives the error as "An error occurred while executing the state 'MyTestState' (entered at the event id #2). Invalid path '$.testonly' : No results for path: $['testonly']"

My Input:

 {
      "testonly":"srin"
   }

Step function definition Code:

{
  "Comment":"Testing the Step function",
  "StartAt":"MyTestState",
  "States": {
    "MyTestState": {
      "Type":"Pass",
       "Parameters": {
       "key1":"value1"
      },
      "OutputPath":"$.testonly",
      "Next":"SecondState"
     },
    "SecondState": {
      "Type":"Pass",
       "End":true
    }
  }
}

But if i remove the Parameters tag in the above code, it is giving me the right output as "srin".Not sure, why I am getting this issue with "Parameters" tag. Can you please let me know, if am missing anything here. ?

asked 2 years ago1662 views
1 Answer
0

As this is a Pass state, the result of the state is what you defined in the Parameters attribute. In your case it only includes "key1". OutputPath is used to filter the output, i.e., to define what from the output will be sent to the next state. As the output does not include the "testonly" attribute, you are getting the error.

What exactly are you trying to do?

profile pictureAWS
EXPERT
Uri
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions