0

I have a step function f1 which is triggered by a scheduled EventBridge Rule, so part of Execution Input is time.

After f1 is completed, I want to trigger a new Step Function f2 through a new EventBridge Rule and pass time as input to f2. I've tried to use transform the input with $.detail.input.time, but it turns out that the input json gets stringified and the search expression fails

Unfortunately, I can't use States.StringToJson as part of the input transformation in the EventBridge rule. All I can do is to pass the horrible and stringified input (including also time as input of f2 through $.detail.input).

Is there any solution to this scenario/limitation?

justHelloWorld
  • 6,478
  • 8
  • 58
  • 138

1 Answers1

0

Use parameters. StepFunction intrinsic functions like States.StringToJson are supported in Task & Pass parameters, but not input fields.

Parse incoming stringified JSON in a Pass State:

{
  "StartAt": "ParsePass",
  "States": {
    "ParsePass": {
      "Type": "Pass",
      "Parameters": {
        "payload.$": "States.StringToJson($.escapedJsonString)"
      },
      "Next": "SuccessTask"
    },
    "SuccessTask": { "Type": "Succeed" }
  }
}

Step Input

{ "escapedJsonString": "{\"foo\": \"bar\"}" }

Step Output

{"payload": { "foo": "bar" }}
fedonev
  • 20,327
  • 2
  • 25
  • 34