antpaw
antpaw

Reputation: 16015

AWS step function stops executing instead of catch

Why is does my step function stop executing instead of following the Catch #1 path?

Studio

Case

Upvotes: 0

Views: 573

Answers (1)

luk2302
luk2302

Reputation: 57184

Because you cannot catch States.Runtime errors. The docs state

States.Runtime An execution failed due to some exception that it couldn't process. Often these are caused by errors at runtime, such as attempting to apply InputPath or OutputPath on a null JSON payload. A States.Runtime error isn't retriable, and will always cause the execution to fail. A retry or catch on States.ALL won't catch States.Runtime errors.

You tried accessing FaceDetails[0]... but there aren't any FaceDetails in your state.

Instead of catching this error you should put a Choice state after the DetectFace to determine whether you actually found a face and only then forward that face detection to the lambda. You can use a IsPresent check for $.FaceDetails[0]: https://stackoverflow.com/a/65693332/2442804 .

Upvotes: 2

Related Questions