bugcrowd / ecs-deployment-monitor

Monitor an ECS Deployment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Container instance cannot be empty

nodesocket opened this issue · comments

Thanks for writing this.

Getting the following error Container instance cannot be empty. Also, once this is working, how are we supposed to get the task definition arn as it changes every deploy? Are we supposed to manually call out to the AWS API to get the task definition arn? Seems like providing the cluster and service name should be enough.

npx ecs-deployment-monitor --cluster arn:aws:ecs:us-west-2:XXXXXXXXXXXX:cluster/prod --service-name api --task-definition arn:aws:ecs:us-west-2:XXXXXXXXXXXX:task-definition/api:33

npx: installed 83 in 3.419s
/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/request.js:31
            throw err;
            ^

InvalidParameterException: Container instance cannot be empty.
    at Request.extractError (/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/protocol/json.js:51:27)
    at Request.callListeners (/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/request.js:688:14)
    at Request.transition (/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/request.js:690:12)
    at Request.callListeners (/Users/justin/.npm/_npx/13914/lib/node_modules/ecs-deployment-monitor/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
  message: 'Container instance cannot be empty.',
  code: 'InvalidParameterException',
  time: 2020-07-15T20:12:44.910Z,
  requestId: '189b4fdc-8d9f-4b37-8c8b-29762ab57672',
  statusCode: 400,
  retryable: false,
  retryDelay: 72.30983724608417
}

@nodesocket I just ran into this this morning as well. I submitted #7 as a temporary workaround to get this package to work on Fargate, which of course doesn't have container instances to worry about.

@nodesocket i'm guessing you're using Fargate too? This library was written before Fargate was released. Sounds like I should update it to make it compatible.

Re the Task Definition Arn. You'll get a task definition arn back whenever you publish a new task definition version. So the expected way to use this is to use the aws cli / sdk to publish a new task definition, then pass that task definition arn to ecs-deployment-monitor.

@coen-hyde thanks for the reply. I actually ended up written my own Lambda Node.js script ecs-deploy-watchguard which is triggered using CloudWatch ECS Rules. It's works pretty well and posts Slack messages when an ECS task goes into an unexpected STOPPED state.

Nice, that's an elegant solution. I might start using your lambda too, as a way to passively monitor ECS tasks

#10 is being prepared to solve this issue.