Reputation: 697
I have a AWS step function workflow of two steps in sequential manner. In each step, I am calling a lambda.
My first lambda is throwing exception after doing some processing. But overall, my step function workflow is executing completely and it is passing.
Am I missing something in step function configuration ? Ideally I want my step function to stop exception as soon as any step is failing (i.e. lambda of that step is failing).
My step function configuration is below:
{
"StartAt": "firstStep",
"States": {
"firstStep": {
"Next": "secondStep",
"Retry": [
{
"ErrorEquals": [
"States.ALL"
],
"MaxAttempts": 1,
"BackoffRate": 1
}
],
"Type": "Task",
"OutputPath": "$",
"ResultPath": "$.Result",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "<some function arn>",
"Payload": {},
"InvocationType": "Event"
}
},
"secondStep": {
"End": true,
"Retry": [
{
"ErrorEquals": [
"States.ALL"
],
"MaxAttempts": 1,
"BackoffRate": 1
}
],
"Type": "Task",
"OutputPath": "$",
"ResultPath": "$.Result",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "<some function arn>",
"Payload": {},
"InvocationType": "Event"
}
}
},
"TimeoutSeconds": 10800
}
Any help or guidance will be appreciated.
Upvotes: 0
Views: 2510
Reputation: 25639
Your current definitions tells Step Functions to retry the Lambdas once. If you wish to fail immediately, either set MaxAttempts: 0
or remove the (optional) Retry
block entirely.
Docs: "By default, when a state reports an error, AWS Step Functions causes the execution to fail entirely."
Also worth noting that if you are catching errors in the Lambda, the Lambda won't report the error.
Upvotes: 2