By using AWS re:Post, you agree to the Terms of Use
/AWS CodeDeploy: STRING_VALUE can not be converted to an Integer/

AWS CodeDeploy: STRING_VALUE can not be converted to an Integer

0

Using AWS CodePipeline and setting a Source, Build and passing taskdef.json and appspec.yaml as artifacts, the deployment action Amazon ECS (Blue/Green) will fail with the error:

STRING_VALUE can not be converted to an Integer

This error does not specify where this error happens and therefore it is not possible to fix.

For reference, the files look like this:

# appspec.yaml
version: 0.0
Resources:
  - TargetService:
      Type: AWS::ECS::Service
      Properties:
        TaskDefinition: <TASK_DEFINITION>
        LoadBalancerInfo:
          ContainerName: "my-project"
          ContainerPort: 3000
// taskdef.json
{
  "family": "my-project-web",
  "taskRoleArn": "arn:aws:iam::1234567890:role/ecsTaskRole-role",
  "executionRoleArn": "arn:aws:iam::1234567890:role/ecsTaskExecutionRole-web",
  "networkMode": "awsvpc",
  "cpu": "256",
  "memory": "512",
  "containerDefinitions":
  [
    {
       "name": "my-project",
       "memory": "512",
       "image": "01234567890.dkr.ecr.us-east-1.amazonaws.com/my-project:a09b7d81",
       "environment": [],
       "secrets":
       [
         {
           "name": "APP_ENV",
           "valueFrom": "arn:aws:secretsmanager:us-east-1:1234567890:secret:web/my-project-NBcsLj:APP_ENV::"
         },
         {
            "name": "PORT",
            "valueFrom": "arn:aws:secretsmanager:us-east-1:1234567890:secret:web/my-project-NBcsLj:PORT::"
         },
         {
           "name": "APP_NAME",
           "valueFrom": "arn:aws:secretsmanager:us-east-1:1234567890:secret:web/my-project-NBcsLj:APP_NAME::"
         },
         {
           "name": "LOG_CHANNEL",
           "valueFrom": "arn:aws:secretsmanager:us-east-1:1234567890:secret:web/my-project-NBcsLj:LOG_CHANNEL::"
         },
         {
           "name": "APP_KEY",
           "valueFrom": "arn:aws:secretsmanager:us-east-1:1234567890:secret:web/my-project-NBcsLj:APP_KEY::"
         },
         { 
           "name": "APP_DEBUG",
           "valueFrom": "arn:aws:secretsmanager:us-east-1:1234567890:secret:web/my-project-NBcsLj:APP_DEBUG::"
         }
       ],
       "essential": true,
       "logConfiguration":
       {
         "logDriver": "awslogs",
         "options":
         {
           "awslogs-group": "",
           "awslogs-region": "",
           "awslogs-stream-prefix": ""
         }
       },
       "portMappings":
       [
         {
           "hostPort": 3000,
           "protocol": "tcp",
           "containerPort": 3000
         }
       ],
       "entryPoint": [ "web" ], 
       "command": []
     }
   ],
   "requiresCompatibilities": [ "FARGATE", "EC2" ],
   "tags":
   [
     {
       "key": "project",
       "value": "my-project"
     }
   ]
}

Any insights on this issue are highly appreciated!

2 Answers
2
Accepted Answer

At the "root level" the cpu and memory are and should be strings which you have correct. Issue looking at ECS Container Def memory should be an integer for the container part.

       "name": "my-project",
       "memory": "512", << Should be "memory": 512
       "image": "01234567890.dkr.ecr.us-east-1.amazonaws.com/my-project:a09b7d81",
answered 4 months ago
  • That is odd and kind of misleading but ended up being the reason. Thanks @Michael_K!

-1

The CodeDeploy agent generates three log files:

  • Agent log – Contains information about the agent’s health and overall deployment status.
  • Deployment log – Contains STDOUT, STDERR, and information specific to the user-defined scripts that run during a deployment.
  • Updater log (Linux agents) – Contains agent updater status.

You can either log into the EC2 instance to view the logs or in the CodeDeploy console, on the event details page for the deployment, choose View logs. This might help to surface some context around the error.

answered 4 months ago
  • @RoB CodeDeploy agent is not involved at this point, as stated above, the error happens within CodePipeline's action and the what is available is a Pipeline Execution ID which only contains the phrase shared which doesn't help. Am I missing something obvious here? Thanks for your interest on helping!

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