I have a StepFunction (Parent) that needs to invoke another StepFunction (Child). I want to pass the ARN to the child step function as input to the child but doing so throws the following error
Invalid Arn: 'Invalid ARN prefix: $.StateMachine.child_ARN' (Service: AWSStepFunctions; Status Code: 400; Error Code: InvalidArn; Request ID: 53d74c73-a33d-48c4-bf56-6001629c40e8; Proxy: null)
The child function definition is;
{
"Type": "Task",
"Resource": "arn:aws:states:::states:startExecution",
"Parameters": {
"StateMachineArn": "$.StateMachine.child_ARN",
"Input": {
"$.input": "$.ExecutionInput"
}
},
"End": true
}
And the parent's runtime input to the child is;
{
"StartTime": "2023-03-11T14:05:42.010Z",
"Region": "us-west-2",
"ExecutionInput": {
"orderID": "1234qwerasdfzxcv"
},
"StateMachine": {
"ProcessAlert_ARN": "arn:aws:states:us-west-2:123456789:stateMachine:child"
}
}
If I change the Parameters for the child function to be; arn:aws:states:us-west-2:123456789:stateMachine:child
it invokes successfully ... but I need to variablelize it. Is that possible?
Append .$
to keys whose values have JSONPath substitutions, e.g. StateMachineArn.$
:
{
"Type": "Task",
"Resource": "arn:aws:states:::states:startExecution",
"Parameters": {
"StateMachineArn.$": "$.StateMachine.child_ARN",
"Input": {
"input.$": "$.ExecutionInput"
}
},
"End": true
}
When a key has no .$
suffix, the State Machine execution interprets the value literally - hence the error message. The relevant docs are here and here.