AWS Step Functions: On Lambda exception, get original input?

Viewed 2080

The Setup

I have an AWS state machine. I have a Lambda that may return a result, or may throw an exception. The step has a catch block defined and depending on the type of exception, follows a different execution path.

The Problem

However, I want to store the input of the Lambda that failed so that it can be reapplied at a later date.

The output from the failed Lambda is the exception.

What I've Tried

Adding OutputPath and ResultPath do not apply when it's an exception.

I don't really want to have to always throw custom exceptions and attach the json input, and then parse through exception messages.

I've tried using a Parallel, sending the input to my Lambda and to a Pass. The result is then an array with the Lambda output (either a successful output, or the exception) and the original input. However, now I need to add a Choice to check to see if there was an exception, and then either continue with the successful output, or branch off with the original input. I can't seem to define a JsonPath in the Choice to check for whether "Error" exists in the first element of the array.

1 Answers
Related