Is it possible to nest a States.Array
within States.ArrayContains
?
I have a variable in my Step Function which attempts this nesting
"ForceRun.$": "States.ArrayContains(States.Array($.args.firststage, $.args.all), true)"
but this yields the following error
An error occurred while executing the state 'firststage' (entered at the event id #29). There was an error while evaluating the intrinsic function: States.ArrayContains(States.Array($.args.firststage, $.args.all), true). Invalid arguments in States.ArrayContains
Is this an error on my part?
Update
To recreate the issue, create a step function which calls another step function as such:
{
"Comment": "A description of my state machine",
"StartAt": "Step Functions StartExecution",
"States": {
"Step Functions StartExecution": {
"Type": "Task",
"Resource": "arn:aws:states:::states:startExecution.sync:2",
"Parameters": {
"StateMachineArn": "arn:aws:states:eu-west-2:<account-id>:stateMachine:test-nested",
"Input": {
"ForceRun.$": "States.ArrayContains(States.Array($.firststage, $.all), true)"
}
},
"End": true
}
}
}
Example input
{"firststage": false "all": true}
I am also able to get it to work in the data flow simulator, but not in a state machine. I have updated my question showing how to recreate the issue.
Hmm... This is mysterious. The documentation says that you can nest up to 10 intrinsic functions within a field, but actually it is not likely to work for any type of the states.
As a workaround, you can define a intermediate state to convert the inputs to array first, and pass the array to
States.ArrayContains
for further process.Thanks for the temporary work around! It would be great if this bug gets fixed rather than having to bloat my step function though.