beanstalk-deploy icon indicating copy to clipboard operation
beanstalk-deploy copied to clipboard

Deployment failed: Error: Status: 400. Code: InvalidParameterValue, Message: No Application Version named '886765199' found.

Open stephanoparaskeva opened this issue 3 years ago • 22 comments

Everything I try results in an error, it seems impossible to use. This is my config:

    steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: Generate deployment package
        run: zip -r deploy.zip docker-compose.yml Dockerrun.aws.json

      - name: Deploy to Elastic Beanstalk
        uses: einaregilsson/beanstalk-deploy@v17
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: archimedes
          environment_name: dev-archimedes
          region: eu-west-1
          version_label: ${{github.run_id}}
          version_description: none
          deployment_package: deploy.zip

ERROR: Deployment failed: Error: Status: 400. Code: InvalidParameterValue, Message: No Application Version named '886765199' found.


Using existing version

    steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: Generate deployment package
        run: zip -r deploy.zip docker-compose.yml Dockerrun.aws.json

      - name: Deploy to Elastic Beanstalk
        uses: einaregilsson/beanstalk-deploy@v17
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: archimedes
          environment_name: dev-archimedes
          region: eu-west-1
          version_label: Sample Application
          version_description: none
          deployment_package: deploy.zip

ERROR: Deployment failed: Version Sample Application already exists. Either remove the "deployment_package" parameter to deploy existing version, or set the "use_existing_version_if_available" parameter to "true" to use existing version if it exists and deployment package if it doesn't.


With use_existing_version_if_available: true

    steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: Generate deployment package
        run: zip -r deploy.zip docker-compose.yml Dockerrun.aws.json

      - name: Deploy to Elastic Beanstalk
        uses: einaregilsson/beanstalk-deploy@v17
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: archimedes
          environment_name: dev-archimedes
          region: eu-west-1
          version_label: "Sample Application"
          version_description: none
          deployment_package: deploy.zip
          use_existing_version_if_available: true

ERROR: Error: Deployment failed: TypeError: Cannot read property 'VersionLabel' of undefined

stephanoparaskeva avatar May 28 '21 20:05 stephanoparaskeva

Hmm, the first one should work, although I would probably use ${{github.run_number}} rather than .run_id. Try it with run_number and see if it works. And you can always look at Elastic Beanstalk and see exactly which application versions have already been created.

einaregilsson avatar May 31 '21 09:05 einaregilsson

@stephanoparaskeva double check that your application_name name is correct. I just created a new one and didn't realize the application name changed. I was getting the same error, because it was publishing my application versions to the wrong one.

tetz2442 avatar Jul 14 '21 13:07 tetz2442

I was using the wrong AWS region...if anyone else ever has this issue...

richardcalahan avatar Oct 26 '21 18:10 richardcalahan

I have the same behaviour as the 3rd one with following config:

deploy:
    name: Deploy
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Generate deployment package
        run: zip -r -j deploy.zip ./dev/* -x '*.git*'

      - name: Deploy to EB
        uses: einaregilsson/beanstalk-deploy@v18
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: dev
          environment_name: dev-env
          version_label: ${{ github.run_number }}
          existing_bucket_name: elasticbeanstalk-eu-west-1-xxxxxxxx
          region: eu-west-1
          deployment_package: deploy.zip
          use_existing_version_if_available: true

I first created a EBS environment, which already created a bucket for me so I used that bucket for the deploys.

It deploys succesfully, health is OK on EBS, but the pipeline fails with ERROR: Error: Deployment failed: TypeError: Cannot read property 'VersionLabel' of undefined

Anyone see what I'm missing here?

jclaessens97 avatar Nov 23 '21 10:11 jclaessens97

@jclaessens97 The only place where there's a .VersionLabel is on the environment. In the line ``` let env = result.data.DescribeEnvironmentsResponse.DescribeEnvironmentsResult.Environments[0]; if (env.VersionLabel === versionLabel && env.Status === 'Ready') {

Sounds like there's some weirdness in the response for DescribeEnvironments after the deployment. Does this happen every time? 

einaregilsson avatar Nov 23 '21 10:11 einaregilsson

Does this happen every time?

@einaregilsson, yeah it seems like it happens everytime. This is the output I get on failure:

Run einaregilsson/beanstalk-deploy@v18
Beanstalk-Deploy: GitHub Action for deploying to Elastic Beanstalk.
https://github.com/einaregilsson/beanstalk-deploy

 ***** Input parameters were: ***** 
         Application: dev
         Environment: dev-env
         Version Label: 17
         Version description: 
         AWS Region: eu-west-1
         File: deploy.zip
         Existing bucket Name: elasticbeanstalk-eu-west-1-xxxxxx
         AWS Access Key: 20 characters long, starts with A
         AWS Secret Key: 40 characters long, starts with Y
         Wait for deployment: true
         Recovery wait time: 30


Uploading file to bucket elasticbeanstalk-eu-west-1-xxxxxx
New build successfully uploaded to S3, bucket=elasticbeanstalk-eu-west-1-xxxxxx, key=/dev/17.zip
Created new application version 17 in Beanstalk.
Starting deployment of version 17 to environment dev-env
Deployment started, "wait_for_deployment" was true...

Error: Deployment failed: TypeError: Cannot read property 'VersionLabel' of undefined

At first I thought the Deployment failed (as the error says 😅 ) but when I looked at AWS all the versions were deployed succesfully despite the error.

jclaessens97 avatar Nov 23 '21 10:11 jclaessens97

@einaregilsson if you can give me some pointers on how to debug/test the pipeline from code I'm willing to see if I can find the issue?

jclaessens97 avatar Nov 24 '21 10:11 jclaessens97

I just pushed a small logging change to a new branch called testversion, basically just this:

  let env = result.data.DescribeEnvironmentsResponse.DescribeEnvironmentsResult.Environments[0];
                console.log('********************+');
                console.log('RESULT FROM DESCRIBEENVIRONMENTS CALL: ');
                console.log(JSON.stringify(result.data, null, 2));
                console.log('********************+');

Try changing your workflow to use: uses: einaregilsson/beanstalk-deploy@testversion

and see what it logs during the deployment.

An easy way to test is also to just run the action as a command line script, it supports that, you could check if it works that way.

einaregilsson avatar Nov 24 '21 11:11 einaregilsson

The response looks pretty empty to me:

********************+
RESULT FROM DESCRIBEENVIRONMENTS CALL: 
{
  "DescribeEnvironmentsResponse": {
    "DescribeEnvironmentsResult": {
      "Environments": [],
      "NextToken": null
    },
    "ResponseMetadata": {
      "RequestId": "256773ac-22b0-4449-83b0-c71197d9d02a"
    }
  }
}
********************+

jclaessens97 avatar Nov 24 '21 11:11 jclaessens97

Ok, and this is the first call? There are no other calls where there's any data?

einaregilsson avatar Nov 24 '21 11:11 einaregilsson

This is the only log I get, so I suppose it's indeed the first one.

jclaessens97 avatar Nov 24 '21 11:11 jclaessens97

Ok, any chance the application name is wrong? I really don't understand why it wouldn't show anything if both the application name and environment name are correct. Very weird!

einaregilsson avatar Nov 24 '21 11:11 einaregilsson

Yes, I carefully copied the application_name & environment_name from AWS & triple checked the region. I think that the proof is that I'm able to deploy new versions from the action, it's just always fails because of that error.

Maybe I'm missing some permissions from my IAM github user?

jclaessens97 avatar Nov 24 '21 14:11 jclaessens97

It's possible I guess, but I'd expect an error in that case. Sorry, I just have no idea why it's not working.

einaregilsson avatar Nov 24 '21 23:11 einaregilsson

@einaregilsson small update, instead of the following 3 inline policies (see image), I now assiged EBSAdministrator policy to my IAM github user and now it works perfectly :)

So it was indeed a permissions problem as I suspected, although it's weird it just doesn't throw a permission exception.

EDIT: Screenshot 2021-11-26 at 09 36 52

jclaessens97 avatar Nov 26 '21 08:11 jclaessens97

@jclaessens97 Ok, thanks for reporting back! And yes, very weird that it doesn't just throw an error but gives you an empty response, that's just guaranteed to get users to spend lots of time trying to figure out what's wrong!

einaregilsson avatar Nov 26 '21 08:11 einaregilsson

@jclaessens97 Ok, thanks for reporting back! And yes, very weird that it doesn't just throw an error but gives you an empty response, that's just guaranteed to get users to spend lots of time trying to figure out what's wrong!

Hi @einaregilsson, I'm using the v21 with admin privileges and still getting the error. Please see https://github.com/oldbonez/docker-react-nevergiveup/actions/runs/4186639519/jobs/7255704349 when time allows and advise.

oldbonez avatar Feb 15 '23 18:02 oldbonez

Flipping application_name and environment_name worked for me. These could just be confusing as to what to put where so might be good to try that out @oldbonez

hkirat avatar Feb 25 '23 18:02 hkirat

Broken workflow - https://github.com/coral-xyz/backpack/actions/runs/4266915453/jobs/7427975203 PR that fixed it - https://github.com/coral-xyz/backpack/pull/2986 Fixed workflow - https://github.com/coral-xyz/backpack/actions/runs/4271220254/jobs/7435539225

hkirat avatar Feb 25 '23 18:02 hkirat

I was using the wrong AWS region...if anyone else ever has this issue...

I was using eu-central-1 instead of us-east-1

Aladdin4u avatar Sep 30 '23 17:09 Aladdin4u

Deployment failed: TypeError: Cannot read properties of undefined (reading 'VersionLabel') @einaregilsson

I can't get past this error, What is your suggestion or is there a version that solves this problem?

muzeyr avatar Oct 03 '23 12:10 muzeyr

Deployment failed: TypeError: Cannot read properties of undefined (reading 'VersionLabel') @einaregilsson

I can't get past this error, What is your suggestion or is there a version that solves this problem?

I also experienced the same issue, but I resolved it by adding the AWSElasticBeanstalkReadOnly permission to the account executing the GitHub Actions. I hope this helps. @muzeyr

dinobotry avatar Oct 11 '23 14:10 dinobotry