Skip to content

copilot svc deploy: sidecar image.build generates invalid CloudFormation YAML (yaml line 451) #7399

@mclqa

Description

@mclqa

Description

copilot svc deploy (and copilot svc package --upload-assets) fails when a Load Balanced Web Service has a sidecar with image.build and the sidecar image is built/pushed during deploy.

Error

generate stack template: apply task definition overrides: unmarshal YAML template: yaml: line 451: found character that cannot start any token

Version

  • Copilot CLI v1.34.1 (also releases/latest linux/arm64)
  • Service type: Load Balanced Web Service
  • Platform: linux/arm64

Reproduction

# manifest excerpt
sidecars:
  nginx:
    port: 80
    image:
      build: Dockerfile-nginx
image:
  location: <prebuilt-ecr-uri>  # main container uses location, not build
copilot svc init --name backend-pr-test
# ensure ECR repo api/backend-pr-test exists
copilot svc deploy --name backend-pr-test --env dev
# or: copilot svc package --name backend-pr-test --env dev --upload-assets

Expected

Valid CloudFormation template is generated and deploy succeeds.

Actual

Template generation fails at YAML parse time in internal/pkg/template/override/override.go (unmarshalYAML), called from internal/pkg/deploy/cloudformation/stack/lb_web_svc.go after ParseLoadBalancedWebService.

Workaround

Pre-build the sidecar image, push to ECR, and use image.location instead of image.build.

Suspected root cause

Sidecar image URI is rendered unquoted in internal/pkg/template/templates/workloads/partials/cf/sidecars.yml:

Image: {{$sidecar.Image}}

Similar class of bug to #3736 (unquoted special characters breaking YAML parse during task definition override step).

Environment

AWS region eu-west-2, Fargate ARM64, Copilot app api, env dev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions