0

I'm setting an Order process using step function and I want to execute its states and wait for 1min when a status will change. Using lambda I created a http/s request from external api that returns an Order object.

 "StartAt": "Process Order",
  "States": {
    "Process Order": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:FUNCTIONTOREQUESThttpJSON",
      "Next": "Is Received?"
    },
    "Is Received?":{
      "Type" : "Choice",
        "Choices": [ 
          {
            "Variable": "$.status",
            "StringEquals": "Received",
            "Next": "Received"
          },
          {
            "Variable": "$.status",
            "StringEquals": "Cancelled",
            "Next": "Cancelled"
          }
      ]
    },

    "Received":{
      "Type": "Wait",
      "Seconds": 60,
      "Next": "Is For Approval or Cancelled?"
    },

     "Is For Approval or Cancelled?":{
      "Type" : "Choice",
        "Choices": [ 
          {
            "Variable": "$.status",
            "StringEquals": "For Approval",
            "Next": "nextState"
          },
          {
            "Variable": "$.status",
            "StringEquals": "Cancelled",
            "Next": "nextState"
          }
      ]
    },

Let say, the current status = "Received" (json from Lambda function http request) if the status changed to "For Approval", it should go to the "For Approval" state. But I'm getting the same status value "Received" even though I already changed it to "For Approval" from the external API.

San
  • 307
  • 1
  • 3
  • 18
  • 1
    What do you mean "I'm getting the same value"? What does your Lambda in the 1st step return? Can you share the real step function definition you're using? – Milan Cermak Feb 18 '19 at 13:38
  • @MilanCermak I updated my question. I'm really new to AWS Step function and Lambda. – San Feb 18 '19 at 21:29

1 Answers1

0

Remember that in AWS Step Functions if you have an input ($.x) and you do not use this ($.x) in any ResultPath in a state to change the value, always the value of $.x is the same. I do not see in your flow where you change or update the value of $ .status

Miguel Conde
  • 813
  • 10
  • 22