What does ElasticBeanstalk error "Application version is unusable and cannot be used with an environment" mean?

Solution 1:

The problem was being caused by failing to wait for the new version to be "processed".

The create-application-version command returned:

  [Exec] {
  [Exec]     "ApplicationVersion": {
  [Exec]         "ApplicationName": "MyApp - DEV", 
  [Exec]         "Status": "PROCESSING", 
  [Exec]         "VersionLabel": "0.1.165", 
  [Exec]         "DateCreated": "2016-04-19T19:27:35.948Z", 
  [Exec]         "DateUpdated": "2016-04-19T19:27:35.948Z", 
  [Exec]         "SourceBundle": {
  [Exec]             "S3Bucket": "xxx", 
  [Exec]             "S3Key": "MyApp.0.1.165.zip"
  [Exec]         }
  [Exec]     }
  [Exec] }

I put in a 3 second delay, then ran describe-application-versions, and got

  [Exec]             "Status": "PROCESSED", 

(interestingly, the DateUpdated did not change)

After that, the update-environment command works fine, and I've deployed several versions without issue.


A proper fix would be to keep running describe-application-versions until Status!="Processing", and then handle all the failure cases (status other than "Processing" or "Processed", or staying as "Processing" forever).

In my case, I'm invoking this from msbuild (where looping and waiting is very difficult), so I'm happy enough with the workaround of an arbitrary delay, and allowing the update-environment command to fail if something goes wrong. Because production remains untouched until update-environment, and actual time taken to deploy (leading up to that command) is not important, I just don't need to go through that much effort.