8

Im creating a POC with nested Step Functions (SF) and have hit the following issue.

  • I have SF A that has a sync task that starts the execution of SF B (using the recently announced syntax) & waits for it to complete.
  • SF B returns a valid JSON output
  • In SF A, I can see (from the output of the task that calls SF B) the correct fields returned. e.g Status, ExecutionArn as well as the Output.
  • I then want to execute a Choice Task in SF A that uses a field returned from SF B. However the json in the Output field returned from SF B is escaped json, so the jsonPath isn't able to extract a field from the output data from the nested json.

Is there something im missing or a recommended approach to this scenario? I could "process" the escaped json string in a lambda or something but using it in the Choice task... but that kinda defeats the point of the nested SF workflow somewhat.

Any help appreciated.

4
  • Did you ever find a solution? I'm building some nested workflows and the same problem exists. I can make an ECS activity that parses the string, but that just feels gross. Commented Jan 27, 2020 at 19:42
  • 1
    No im afraid not. We were evaluating Step Functions at the time and didn't take it any further Commented Jan 28, 2020 at 20:03
  • 1
    Thanks for the answer. I put in a support ticket asking about it, and their response said that it was a known feature request, and that it was on the roadmap, although they couldn't give me a release date. Commented Jan 28, 2020 at 20:12
  • @mbragg02 agree it is less than ideal but for now it seems the best way to parse outputs between step functions is to use a lambda. Otherwise, perhaps store the outputs (maybe you want to persist this information for audit purposes anyway) in a dynamodb which links to the execution id and then you can read that between steps? Commented Apr 17, 2020 at 7:19

2 Answers 2

6

Not sure it's new since you asked the question but the answer is in the link you provided: Use "arn:aws:states:::states:startExecution.sync:2" in the task resource field instead of "arn:aws:states:::states:startExecution.sync"

state output type table

Sign up to request clarification or add additional context in comments.

1 Comment

This is the correct answer. Version 2 of the startExecution integration (arn:aws:states:::states:startExecution.sync:2) outputs JSON instead of an escaped string. docs.aws.amazon.com/step-functions/latest/dg/…
2

I ran into the same issue. I used "OutputPath": "$.Output" at first and that returned the escaped json. I removed that and added "ResultPath": "$.Output", This works, it returns the output as json including the escaped version. Its ok for now until AWS addresses this.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.