Search code examples
amazon-web-servicesaws-code-deploy

CodeDeploy giving a Ruby error when I try to deploy


appspec.yml:

version: 0.0
os: linux
files:
  - source: /
    destination: /var/ingester
permissions:
  - object: /var
    pattern: ingester
    owner: ubuntu
    group: ubuntu
    type:
      - directory
  - object: /var/ingester
    owner: ubuntu
    group: ubuntu
hooks:
  ApplicationStart:
    - location: deployment/start.sh
      runas: ubuntu

Codedeploy gets to BeforeInstall and then errors with:

ERROR [codedeploy-agent(2735)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Error during perform: TypeError - no implicit conversion of String into Integer - /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/application_specification/application_specification.rb:49:in `[]'

It looks as though this is related to the parsing of the YAML, but I can't figure out what it's trying (and failing) to convert to an integer.

Can anyone spot what's going wrong here?


Solution

  • After a hint from Ravi (see OP comments), I checked the appspec.yml on the EC2 box and it appeared to be an old copy, missing the hyphen before the source: in the YAML. Thus, Ruby interpreted it as a hash instead of an array.