0

I have created an AWS Codepipeline that runs in four stages. 1) Source code from github, 2) deploy backend to Elastic Beanstalk, 3) build fronted code with Codebuild (using the buildspec file below), and 4) deploy results of webpack to S3.

Everything works as expected so far except for the results of stage 3. Codebuild seemingly sets the artifacts as the source files and not the results of the webpack build. When I look in the bucket and folder for the deployed code, I'm expecting to see a series of js asset files and a manifest.json. Instead, I see the project files. Not quite sure what I'm configuring wrong here.

buildspec.yml

version: 0.2

phases:
  install:
    runtime-versions:
      nodejs: 12
    commands:
      - echo Installing dependencies...
      - yarn
  build:
    commands:
      - echo Building project...
      - yarn build
  post_build:
    commands:
      - echo build completed on `date`

artifacts:
  files:
    - '**/*'

cache:
  paths:
    - '/root/.npm/**/*'
    - '/node_modules/'

webpack-build configuration enter image description here

webpack-deploy configuration enter image description here

1 Answer 1

1

After a few hours of troubleshooting, I was finally able to figure out what was going on.

Running yarn build on the project bundles everything into a /dist folder. The artifacts line, however, indicates that the files that should be uploaded to S3 are all of the project files. So the fix was as simple as updating **/* to dist/**/*.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.