AWS CodeDeploy: STRING_VALUE can not be converted to an Integer
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!
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",
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.
@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!
Relevant questions
AWS CodeDeploy: STRING_VALUE can not be converted to an Integer
Accepted Answerasked 4 months agoInternal error with CodePipeline + CodeDeploy
asked 3 years agoCodePipeline -> CodeDeploy blue/green ECS Insufficient permissions
asked 3 years agoSpot Instance interruption while CodeDeploy is running a deployment to an Auto Scaling group
Accepted AnswerCodePipeline creates a BuildArtif and SourceArti key for build artifacts by default. Is this configurable?
asked 3 months agoDeploy only a subset of source using CodeDeploy S3 provider
Accepted Answerasked 5 months agoAWS Codepipeline is very slow(source to build stage)
asked 3 years agoCodePipeline - how to pass and consume multiple artifacts across CodeBuild Steps?
asked 4 months agoTruncatingBigNumber can not be converted to an String
asked a year agoCodeDeploy/CodePipeline Action execution failed InternalError. Error reference code
asked 19 days ago
That is odd and kind of misleading but ended up being the reason. Thanks @Michael_K!