Unexpected key 'enableFaultInjection' found in params

5

suddenly,not able to deploy the task definition. It has "enableFaultInjection":false as default value but failing the deployment with the following error:

Error: Failed to register task definition in ECS: Unexpected key 'enableFaultInjection' found in params Error: Unexpected key 'enableFaultInjection' found in params

Here is the screenshot of my task definition JSON:

Enter image description here

  • I have a the same error but in Github during a deploy of ECS, any ideas how to fix it?

  • Same issue in Github deploy too. Tried the solution by oscarcrespo but no luck.

asked 16 days ago4.7K views
3 Answers
8

You are likely using v1 of the ecs-deploy-task-defintion GitHub action, you should be using v2 as this was fixed there yesterday as well.

- name: Deploy Amazon ECS task definition
  uses: aws-actions/amazon-ecs-deploy-task-definition@v2
  with:
     task-definition: task-definition.json
answered 15 days ago
profile pictureAWS
EXPERT
reviewed 15 days ago
  • That fixed it! Thank you

  • yep this worked! Thanks for the quick reply!

  • This fixed the issue for me as well. @Henrique Santana, do you happen to know what caused v1 to break?

-2

this is a temporary solution that fixes this. Add it to your action script after getting task definition

 - name: Remove enableFaultInjection from task-definition.json
      shell: bash
      run: |
        jq 'del(.enableFaultInjection)' task-definition.json > task-definition-fixed.json
        mv task-definition-fixed.json task-definition.json
answered 15 days ago
  • This is the ChatGPT answer and will fix the problem, but it is fundamentally incorrect as it doesn't identify the root cause (AWS update) or deal with it (use updated definition).

-9

The error you're encountering suggests that there's an issue with the task definition JSON you're trying to deploy. The "enableFaultInjection" parameter is not a standard parameter in ECS task definitions, which is why you're seeing the "Unexpected key" error.

To resolve this issue, you should remove the "enableFaultInjection" field from your task definition JSON. This parameter is not recognized by ECS and is causing the deployment to fail.

Here are the steps you can take to fix this:

  1. Edit your task definition JSON.
  2. Remove the line containing "enableFaultInjection":false.
  3. Save the updated task definition.
  4. Try to deploy the task definition again.

If you're using some kind of infrastructure-as-code tool or template to generate this task definition, you may need to update that template to remove the "enableFaultInjection" parameter.

After removing this unexpected key, your task definition should deploy successfully, assuming there are no other issues with the configuration.

If you're wondering about the origin of this parameter, it's possible that it was inadvertently added during a copy-paste operation or through some automated process. It's not a standard ECS parameter, which is why it's causing the deployment to fail.

Remember to always validate your task definition JSON against the ECS task definition schema to catch these kinds of issues before attempting to deploy.
Sources
ECS deployment task failed (deployed on EC2) | AWS re:Post
How to debug failed ECS deployment? | AWS re:Post

profile picture
answered 16 days ago
  • It was working fine until today. Tried to remove this from "task definition JSON " but it still comes with default value as "False".

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions