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. ?

已提問 2 年前檢視次數 1726 次
1 個回答
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
專家
Uri
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南