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.

已提问 1 个月前5106 查看次数
3 回答
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
已回答 1 个月前
profile pictureAWS
专家
已审核 1 个月前
  • 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
已回答 1 个月前
  • 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
已回答 1 个月前
  • It was working fine until today. Tried to remove this from "task definition JSON " but it still comes with default value as "False".

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则