InvalidDefinition error when creating a step-functions state machine with a "Map" state in the docker image amazon/aws-stepfunctions-local for local testing

4

Hi everyone,

I am running the amazon/aws-stepfunctions-local docker image locally and creating a state-machine which contains a Map state. But the creation fails with the following error message:

An error occurred (InvalidDefinition) when calling the CreateStateMachine operation: Invalid State Machine Definition: ''SCHEMA_VALIDATION_FAILED: These fields are required: [Iterator] at /States/MapState', 'SCHEMA_VALIDATION_FAILED: Field 'ItemProcessor' is not supported at /States/MapState''

Is it possible to create a state-machine with a Map state in the docker-image amazon/aws-stepfunctions-local for local testing?

More dailed description below:

I am doing the following:

docker run -d --name workflow_test -p 8083:8083 \
	--mount type=bind,readonly,source="$PWD/src/test/WorkflowTest_Mock.json",destination=/home/StepFunctionsLocal/MockConfigFile.json \
	-e SFN_MOCK_CONFIG="/home/StepFunctionsLocal/MockConfigFile.json" amazon/aws-stepfunctions-local 


# In another terminal
aws stepfunctions create-state-machine \
    --endpoint http://localhost:8083 \
    --definition "$(cat src/test/test.json)" \
    --name "LambdaSQSIntegration" --role-arn "arn:aws:iam::123456789012:role/service-role/LambdaSQSIntegration"

where src/test/test.json contains the following:

{
  "Comment":"Test",
  "StartAt":"MapState",
  "States":{
	  "MapState": {
		"Type": "Map",
		"ItemProcessor": {
		  "ProcessorConfig": {
			"Mode": "INLINE"
		  },
		  "StartAt": "MyTask",
		  "States": {
			"MyTask": {
			  "Type": "Task",
			  "Resource": "<my-arn>", # substituted
			  "End": true
			}
		  }
		},
		"End": true
	  }
  }
}
1 Answer
2
Accepted Answer

Hello,

We can definitely create a state-machine with Map state in the docker-image amazon/aws-stepfunctions-local. However, upon testing it with the latest Version: 1.12.0 [1], I could confirm that Step Function Local is not yet moved to new schema and therefore, "ItemProcessor" is currently not supported.

Alternately, you may use "Iterator" in the state machine definition as follows :

{
  "Comment":"Test",
  "StartAt":"MapState",
  "States":{
	  "MapState": {
		"Type": "Map",
                "Iterator": {
		  "StartAt": "MyTask",
		  "States": {
			"MyTask": {
			  "Type": "Task",
			  "Resource": "<my-arn>", # substituted
			  "End": true
			  }
		     }
		  },
		"End": true
	    }
     }
}

I have created a feature request to the service team. While I am unable to comment on if/when this feature may get released, I request you to keep an eye on our What's New[2] and Blog[3] pages for any new feature announcements.

[1] https://hub.docker.com/r/amazon/aws-stepfunctions-local/tags

[2] https://aws.amazon.com/new/

[3] https://aws.amazon.com/blogs/aws/

AWS
answered 2 years ago
profile picture
EXPERT
reviewed 6 months ago
  • Is there a direct link to the feature request that we can follow? Our team is also experiencing this issue.

  • As above, we're experiencing the same issue, tested with the latest amazon/aws-stepfunctions-local, 1.12.2. The fields were deprecated in Dec 2022 so it would be great to use the current language. Beyond name changes (Iterator to ItemProcessor and Parameters to ItemSelector), this issue means that it isn't possible to use Distributed Maps. Any current config needs to be backported to remove invalid fields (e.g. ProcessorConfig doesn't exist under Iterator) & as docs have been removed for Iterator/Parameters, you have to hunt for old docs or guess (!) the syntax based on old & current examples.

  • Is it possible to get an update as to where this is at and a link to the feature request as @jim-salyer-efleets mentioned above? A changelog/release notes for https://hub.docker.com/r/amazon/aws-stepfunctions-local would be really helpful - otherwise we as users are flying blind as to what's changed and when. I appreciate the links you mentioned @Akanksha_T but there's no mention of aws-stepfunctions-local in any past news article or blog post, which makes it seem unlikely there will be any time soon.

  • Why is there no public issue tracker for this tool?

    A year later it still has no support for current Map state syntax.

    The tool delivers poor value if it's not actively supported, and the tool is pretty vital for serious users of Step Functions.

  • Hitting this same problem. Is there a workaround for aws-stepfunctions-local 1.14 not understanding Item-Reader?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions