I've been playing around with CodeBuild and CodePipeline recently and ran across this problem.
Once the CodeBuild finishes successfully, it should upload the build artifact to an S3 bucket. But I noticed that when I click on the View Artifacts button it just tells me that an error occured, and my S3 bucket does not have the build artifact as well.
Codebuild finished successfully
But clicking on the 'View Artifacts' link takes me to this error message.
Somehow it looks like my build Artifact was not uploaded to S3
This is my Buildspec.yaml
version: 0.2
phases:
build:
commands:
- echo "Entering build"
- npm install
- echo "Finishing build"
I figured out that I need to add the artifacts to the build spec file as well. This wasn't added to the Buildspec by default when I created the Buildspec.yaml file on codebuild.
version: 0.2
phases:
build:
commands:
- npm install nodemon
- echo "Entering build"
- npm install
- echo "Finishing build"
artifacts:
files:
- '**/*'
After adding this codebuild automatically uploads the build artifact to the S3 bucket as intended.