Federico Agudelo Mejia
Federico Agudelo Mejia

Reputation: 407

Codebuild, buildspec error ;Phase context status code: YAML_FILE_ERROR Message: Expected to be of struct type: found string instead at line 1

I am having trouble running the buildspec file stored in an s3 bucket , the following error ocurs when I am in the build step of the pipeline;

"Phase context status code: YAML_FILE_ERROR Message: Expected to be of struct type: found string instead at line 1, check indentation or content around the line num"

The Following is how I have my buildspec.yml

version: 0.2
env:
  variables:
    APP_NAME: "angular-cicd-pipeline-demo"
phases:
  install:
    runtime-versions:
      nodejs: 16.x
    commands:
      - echo install process started
      - npm install && npm install -g @angular/cli
  build:
    commands:
      - echo build process started now
      - cd software/frontend/culturi
      - ng build --configuration=production
  post_build:
    commands:
      - echo build process finished, we should uplload to S3 now
      - cd dist/$APP_NAME
      - ls -la
      - aws s3 sync . s3://app-culturi --delete

Upvotes: 0

Views: 4289

Answers (1)

Joe
Joe

Reputation: 11

I spent hours trying to figure this out for myself. The yml file needs to be structured very precisely. I had the same error when my "command" lines had the same indentation as the "build/ post_build" lines. It worked when I indented the "command" lines a little further like you have now. For you, I recommend leaving an empty line after your "version" line. I hope that works!

Upvotes: 1

Related Questions