Pipeline failing: Unknown parameter in input: "registeredAt"
Asked by Anuj:

Urgent help required. Production Pipeline failing

Using **atlassian/aws-ecs-deploy:1.3.0**

The pipelines to ECS are failing with the following error

    ? ECS task definition parameter validation error: Parameter validation failed:

    Unknown parameter in input: "registeredAt", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode, proxyConfiguration, inferenceAccelerators
    Unknown parameter in input: "registeredBy", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode, proxyConfiguration, inferenceAccelerators

Earlier it was working fine.

Following is the task definition

    {
      'containerDefinitions': [], 
      'executionRoleArn': 'arn:aws:iam::<user>:role/ProdECSRole', 
      'family': 'backend-task-def',
      'networkMode': 'bridge',
      'placementConstraints': [],
      'registeredAt': 1610533632.651,
      'registeredBy': 'arn:aws:iam::<user>:user/bitbucket-prod', 
      'requiresCompatibilities': ['EC2'],
      'taskRoleArn': 'arn:aws:iam::<user>:role/ProdECSRole',
      'volumes': []
    }


Answers:
author: Oleksandr Kyrdan
body: Hi [@Anuj](/t5/user/viewprofilepage/user-id/2517176) ,

Thank you for your question.

It looks like it's AWS [issue](https://github.com/aws/aws-cli/issues/5882) relates to the latest AWS API update.

We're investigating the issue and will notify you of any updates.

It would be nice if you provide us with more details: how long have you used aws-esd-deploy pipe with "registeredAt" and "registeredBy" params?

comments: author: Anuj
body: The last successful deployment was on January 13, 2021


author: Halyna Berezovska
body: [@Anuj](/t5/user/viewprofilepage/user-id/2517176) is it necessary for you to keep these arguments in task definition? Looks like they are not provided anymore in documentation and I don't know if they've been ever provided. AWS respond with these parameters, but does not take into task definition (or they have updated documentation).

Have you tried to remove these fields, if you don't really need it?

It is because these are actually not allowed fields in task definition, these are post-processing fields, that aws cli creates after registering your task definition - it is like general createdAt fields.

Since we did not upgrade any version of aws libraries, neither botocore, no boto3 and not awscli , this looks like really aws documentation or aws server problem referring to the issue that [@Oleksandr Kyrdan](/t5/user/viewprofilepage/user-id/2885705) has mentioned.

Regards, Galyna


author: Anuj
body: I don't think I'm adding these values.

I use the following script to update the existing task definition, so the definition is retrieved from the AWS and replaced the required values only

```
TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition "$AWS_ECS_TASK_FAMILY")
NEW_TASK_DEFINITION=$(echo "$TASK_DEFINITION" | jq --arg IMAGE "$ECR_IMAGE_TAG" '.taskDefinition | .containerDefinitions[0].image = $IMAGE | del(.taskDefinitionArn) | del(.revision) | del(.status) | del(.requiresAttributes) | del(.compatibilities)')
```

And using the NEW_TASK_DEFINITION in the pipeline


author: Halyna Berezovska
body: [@Anuj](/t5/user/viewprofilepage/user-id/2517176) ,

So I know what the problem is.

When you describe task definition, it responds to you with ALL fields that it make it visible. So registeredAt and registeredBy are those fields in the response, but not acceptable by AWS server side validator anymore (<https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTaskDefinition.html>).

So you change just the image tag to deploy, but still want task definition to be new one to update the service.

Unfortunately, we're not able to fix this by upgrading AWS libraries, because it is on their server side.

But you can remove these not-acceptable fields by the same tool you're using - jq. Just like you remove other not needed fields

Is this solution fine for you? We are looking forward to your update and feedback, so we can investigate firther if there is still a problem resolving this.

Regards, Galyna


author: sunilamara
body: Append the additional values **\| del(.registeredAt) \| del(.registeredBy)')**to your NEW_TASK_DEFINITION and run the pipeline.

--

Regards,

Sunil Amara


author: Anuj
body: [@Halyna Berezovska](/t5/user/viewprofilepage/user-id/3865505) Thanks. After deleting these params (as suggested by [@sunilamara](/t5/user/viewprofilepage/user-id/2824194) ) worked.


author: Halyna Berezovska
body: [@Anuj](/t5/user/viewprofilepage/user-id/2517176)

I have not found registeredAt, registeredBy parameters in Request syntax of <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.register_task_definition>.

These parameters are only in Response syntax, I believe they cannot exist in request syntax, because they are like update_at, created_at paramters, that can persist only AFTER the request processing.

Check out this doc and ensure that you have right parameters , but pay attention only to Request Syntax. At the first glance to fix this, you have to remove these two params.

Regards, Galyna


Tags: aws

bitbucket-pipelines

cloud