Fun with ambiguous errors

I was hoping that my first post here would be about the open source projects I've been working on, along with the fun side projects that keep my brain occupied outside of work

I'll get there soon, but I got distracted with what I can only describe as the most ambiguious error I've seen on AWS

'An App Spec file is required, but could not be found in the revision'

Creating a CodePipeline that uses the CodeDeploy controller for ECS is very well documented - However, the documentation focuses on achiveing it via the AWS UI

I had a case where we needed to generate the App Spec file within the CodeBuild Project and output it as an artifact

I got that all working - CodeBuild created an appspec.json file, included it in the output artifact, then provided as an input source for the Deploy stage on CodePipeline

However ...

App Spec generic error

I first Googled the error ... Which made me believe that the name has to be appspec.yml - with references to documentation [https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-validate.html]

I then spent a long time adjusting the file name, and format, to yml,yaml,json and just in case JSON ... 🤦

Still, got the same Error - 'An App Spec file is required, but could not be found in the revision'

It turns out, that this error is shown, for many many reasons ... 

Even via aws cli, we get:

$ aws deploy get-deployment --deployment-id $DEPLOMENT_ID
"errorInformation": {
"code": "INVALID_REVISION",
"message": "An AppSpec file is required, but could not be found in the revision"
}

First important findings

  • The App Spec file - It can be named Anything 
  • When provided to CodeDeploy within CodePipeline, it has to be the only file within the input artifact
  • I could create an input artifact to CodeDeploy that included a file called blah.json, and it would work. However, If the input artifact included any other file, it will throw the error

All the mistakes I found that produce the same error:

Conclusion

  • When creating a revison for CodeDeploy, ensure that appspec.* is the only file included in the revision
  • Ensure that the App Spec file is well formatted (Don't use the App Spec assistant), just dont include the version
  • After figuring out all of this, an 8 sided Rubix cube sounds like fun ...