I have a pipeline defined in AWS Step Functions. One step is defined as Fargate Task, which pulls a docker image and run some python code. I've surprisingly found that if the container running in the Fargate task encounters a runtime error the Step Functions doesn't catch the failed task and continue the pipeline as normal (setting the Fargate task as successful), but according to the documentation the pipeline should fail as soon as this happens.
This is the step function definition:
{
"Comment": "My state machine",
"StartAt": "MyFargateTask",
"States": {
"MyFargateTask": {
"Type": "Task",
"Resource": "arn:aws:states:::ecs:runTask.sync",
"InputPath": "$",
"Parameters": {
"Cluster": "my-cluster",
"TaskDefinition": "arn:aws:ecs:us-east-1:617090640476:task-definition/my-task:1",
"LaunchType": "FARGATE",
"NetworkConfiguration": {
"AwsvpcConfiguration": {
"Subnets": [
"subnet-xxxxxxxxxxxxxxxxx",
"subnet-yyyyyyyyyyyyyyyyy"
],
"AssignPublicIp": "ENABLED"
}
},
},
"Next": "Done"
},
"Done": {
"Type": "Succeed"
}
}
}
I've tried the following simple python code for the Fargate container:
def main():
raise Exception("foobar")
if __name__ == '__main__':
main()
In the container logs on CloudWatch I can see the program failing as expected, but the pipeline in the Step Function succeeds (all green). What am I missing? Is this a bug?