I have AWS step machine and one of the step is used to notify failure using SNS service. I want to select some metadata from input
json into outgoing message. So i am trying to concatenate constant string with jsonpath like below
"Notify Failure": { "Type": "Task", "Resource": "arn:aws:states:::sns:publish", "Parameters": { "Message.$": "A job submitted through Step Functions failed for document id $.document_id", "Subject":"Job failed", "TopicArn": "arn:aws:sns:us-west-2:xxxxxxx:xxxxxxxx" }, "End": true }
where document_id
is one of the property in input json
However when i try save state machine defination i get error
There is a problem with your ASL definition, please review it and try again The value for the field 'Message.$' must be a valid JSONPath
I was able to solve a similar issue using:
"Message.$": "States.Format('A job submitted through Step Functions failed for document id {}', $.document_id)",
Described in a AWS News Blog post.
The JSONPath implementation referenced from the AWS Step Functions documentation supports String concatenation via $.concat($..prop)
but sadly this does not work when deployed to AWS, suggesting that AWS uses a different implementation.
Therefore there is no way to do string concatenation with JSONPath in AWS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With