amazon-web-servicesaws-step-functionsaws-stepfunctions-local

Does AWS Step-functions-local support map tasks?


I am trying to write automated tests using the AWS Step-Functions-Local service against a state machine that has a map task in it. I can create the state machine just fine with no errors in the step-functions-local container, but as soon as I try to execute one of the tests, I get an error message indicating that my state machine has syntax errors.

So, I created a state machine from scratch that had only a map task and a success step. Got the same error executing a test against it. Removed the map task and the test passed.

I know that the local version doesn't have full feature parity, but I have yet to find something that explains definitely what is / isn't there. I'm guessing the answer to my question is that map tasks are one of those missing features, but I want to make sure that I haven't done something wrong.


Solution

  • I think you were using ItemProcessor field, which is used to define processing steps within a Map State, which is not supported in Step Function Local. Instead you can use the Iterator field when defining Map states for local testing.

    https://docs.aws.amazon.com/step-functions/latest/dg/state-map-inline.html

    this is an example of the iterator:

    {
      "Type": "Map",
      "ItemsPath": "$.items",
      "Iterator": {
        "StartAt": "YourTaskState",
        "States": {
          "YourTaskState": {
            "Type": "Task",
            "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",
            "End": true
          }
        }
      },
      "End": true
    }
    

    if this didn't work out also, feel free to share some code snippet to check it