Step Function error handling
0
I have a state that updates DynamoDB by shifting the first word off a list of words. It returns UPDATED_OLD so that the word can be grabbed in the ResultSelector block as index 0 and passed on to the next step. If there are words in the list this works fine, but if the list is empty, there is nothing at index 0 and Step Functions throws a States.Runtime error and the execution fails. I added a Catch block but it isn't catching as expected. Can this error be caught? Thank you.
asked 2 months ago13 views
1 Answers
0
Use a Choice state to check for existence of array0. Something like this:
{
"StartAt": "CheckArrayEmpty",
"States": {
"CheckArrayEmpty": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.array[0]",
"IsPresent": true,
"Next": "NotEmpty"
}
],
"Default": "Empty"
},
"NotEmpty": {
"Type": "Pass",
"End": true
},
"Empty": {
"Type": "Pass",
"End": true
}
}
}
Relevant questions
AWS step function giving error, when I had included the "Parameter" tag
asked 5 days agoCan I specify GET URL path parameter in step function?
asked 3 months agohow to trigger a step function from a s3 object notification?
asked a month agoHow can I identify the sender of a shadow update that's been forwarded?
Accepted Answerasked 3 months agoHow to get the full list of words that Amazon Transcribe can recognize for a specific language?
asked 3 months agoHow can I fix the AWS Inspector v2 error "Two state changes cannot be made at the same time."?
asked a month agoGetting 403 Forbidden errors when trying to send emails through SES with the word "select" in them
asked 4 months agoUnable To create a step function
asked 5 years agoThrottlingException from Step Function triggered through API Endpoint
asked 2 years agoStep Function error handling
asked 2 months ago
Thank you for replying Uri. I came up with a work-around outside of this step function but I would still like to know about catching the error. Is this a bug in the service?