An error occurred (ClientException) when calling the DescribeTaskDefinition operation
Asked Answered
S

1

7

I am facing issue while describing ecs task definition via running thorugh bitbucket pipeline.

Issue i face is like below,

An error occurred (ClientException) when calling the DescribeTaskDefinition operation

command i use to execute via shell script in bitbucket pipeline as below,

LATEST_TASK_DEFINITION=$(aws ecs describe-task-definition  --task-definition ${TASK_FAMILY})

echo $LATEST_TASK_DEFINITION \
                 | jq '{containerDefinitions: .taskDefinition.containerDefinitions, volumes: .taskDefinition.volumes}' \
                                          | jq '.containerDefinitions[0].image='\"${DOCKER_IMAGE}\" \
                                                           > /tmp/tmp.json
aws ecs register-task-definition --family ${TASK_FAMILY} --cpu 256 --memory 512 --network-mode awsvpc --requires-compatibilities "FARGATE" --task-role-arn arn:aws:iam::xxxxxxx:role/ECSTaskExecutionRole --execution-role-arn arn:aws:iam::xxxxxxx:role/ECSTaskExecutionRole --cli-input-json file:///tmp/tmp.json

issue in bitbucket

But when i am running same commands from linux terminal its running.

Anyone face such kind of issue?

Thanks in advance.

Stander answered 6/7, 2021 at 5:17 Comment(4)
Try with jq -r.Furrow
@Furrow let me use this option. ThxStander
this issue is closed now. Thanks @FurrowStander
Did it work? I can provide a full answer.Furrow
J
1

I experienced this issue when I was setting up an ECS cluster, task definition file, and service using Terraform.

It also happened at the point of deployment to an already set-up ECS cluster using Circle CI.

I get the error below when I run terraform apply or when I try to deploy using Circle CI:

An error occurred (ClientException) when calling the DescribeTaskDefinition operation: Unable to describe task definition.

Here's how I resolved it:

For Terraform:

The issue had to do with a typo in the cluster name that was not correct with how the service was referencing it. All I had to was to delete the name for the cluster name and had to retype it. This time the service was able to reference it correctly.

For Circle CI:

The issue had to do with a typo in the cluster name environment variable for the Circle CI project that was not correct with how the service was referencing it. All I had to was to delete the cluster name environment variable and I had to set the correct cluster name environment variable. This time the service was able to reference it correctly.

Reference: Unable to describe task definition

Judo answered 30/9, 2022 at 22:27 Comment(1)
> I've only seen this error when I have a typo in either the cluster name or service name. This excerpt from the reference link is the shortest answer. I have resolved my issue by fixing the service name.Clinic

© 2022 - 2024 — McMap. All rights reserved.