Search code examples
amazon-web-servicesaws-step-functions

Map executing another step function does not pass any input


Can't figure this one out : the step function executed inside a map ALWAYS has an empty dict in input. I need the input to be {"id": "xxxx"}

Here is the map element :

"Map": {
  "Type": "Map",
  "ItemProcessor": {
    "ProcessorConfig": {
      "Mode": "INLINE"
    },
    "StartAt": "InsideStep",
    "States": {
      "InsideStep": {
        "Type": "Task",
        "Resource": "arn:aws:states:::states:startExecution.sync:2",
        "Parameters": {
          "StateMachineArn": "arn:aws:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        },
        "End": true
      }
    }
  },
  "Next": "Consolidate logs",
  "Catch": [
    {
      "ErrorEquals": [
        "States.ALL"
      ],
      "Next": "Log error",
      "ResultPath": "$.error"
    }
  ],
  "ItemsPath": "$.ids_list",
  "MaxConcurrency": 10,
  "Parameters": {
    "id.$": "$$.Map.Item.Value"
  }
}

Thanks for any help


Solution

  • Here is the working solution, thanks to luk2302 suggestions

    "Map": {
      "Type": "Map",
      "ItemProcessor": {
        "ProcessorConfig": {
          "Mode": "INLINE"
        },
        "StartAt": "InsideStep",
        "States": {
          "InsideStep": {
            "Type": "Task",
            "Resource": "arn:aws:states:::states:startExecution.sync:2",
            "Parameters": {
              "StateMachineArn": "arn:aws:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
              "Input": {
                "id.$": "$"
              }
            },
            "End": true
          }
        }
      },
      "Next": "Consolidate logs",
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "Log error",
          "ResultPath": "$.error"
        }
      ],
      "ItemsPath": "$.ids_list",
      "MaxConcurrency": 10
    }