Kaguei Nakueka
Kaguei Nakueka

Reputation: 1108

Step Functions - How to pass the complete input from a stage to the next one?

In one of my state machines, I have a stage which is getting the following input from its previous stage:

{
  "name": "put_book",
  "input": {
    "flight_timestamp": "1671872521",
    "flight_from": "GRU",
    "flight_to": "BER",
    "customer_id": "[email protected]",
    "passenger_lastname": "Scott",
    "passenger_firstname": "Michael",
    "TaskResult": {
      "Output": {
        "booking_id": "8aa96d88-2a0b-7777-9999-94f3edb46b6c"
      }
    }
  },
  "inputDetails": {
    "truncated": false
  }
}

I would like to pass the booking_id value to the next stage, however the output looks like this:

{
  "name": "Parallel",
  "input": {
    "flight_timestamp": "1671872521",
    "flight_from": "GRU",
    "flight_to": "BER",
    "customer_id": "[email protected]",
    "passenger_lastname": "Scott",
    "passenger_firstname": "Michael",
    "TaskResult": {
      ... Execution information...
  "inputDetails": {
    "truncated": false
  }
}

My put_book stage looks like this:

"put_book": {
      "Type": "Task",
      "Resource": "arn:aws:states:::dynamodb:putItem",
      "Parameters": {
        "TableName": "TABLE",
        "Item": {...}
      },
      "InputPath": "$",
      "ResultPath": "$.TaskResult",
      "OutputPath": "$",
      "Next": "Parallel"
    },

I tried to simulate it through the Data flow simulator and it worked!

enter image description here

How can I pass the booking_id forward in my state machine too?

Thanks!

Upvotes: 0

Views: 1582

Answers (1)

Kaguei Nakueka
Kaguei Nakueka

Reputation: 1108

"ResultPath": "$.TaskResult"

was causing the "issue" by replacing the previous result

Upvotes: 1

Related Questions