amplify-cli-action icon indicating copy to clipboard operation
amplify-cli-action copied to clipboard

prod environment does not exist, consider using add_env command instead

Open hamzajaved12 opened this issue 4 years ago • 6 comments

hamzajaved12 avatar Jan 21 '21 13:01 hamzajaved12

When I use amplify_env: prod it gives the above error but when I used amplify_env: dev it works fine why?

hamzajaved12 avatar Jan 21 '21 13:01 hamzajaved12

Environment names are arbitrary but must exist in AWS, by default $ amplify init command only instantiates a dev env.

While README.md for Github Actions template mentions prod as the default target, you're still required to add it to your AWS resource.

    - name: configure amplify
      uses: ambientlight/[email protected]
      with:
        amplify_command: configure
        amplify_env: prod       # Environment name that exists in CloudFormation Amplify target

    - name: deploy
      uses: ambientlight/[email protected]
      with:
        amplify_command: publish
        amplify_env: prod      # Environment name that exists in CloudFormation Amplify target

See Amplify Docs on adding environments using the command $ amplify env add.

sar avatar Jun 22 '21 15:06 sar

I'm also having this issue. I've specified my amplify_env in my template, and the env exists in the amplify app on both FE/BE so I don't know why this isn't working. My amplify_cli_version is 6.1.0.

      - name: configure amplify
        uses: ambientlight/[email protected]
        with:
          amplify_command: configure
          amplify_env: main
          project_dir: client
          amplify_cli_version: 6.1.0
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_REGION: us-east-2

danieldaugherty avatar Oct 12 '21 15:10 danieldaugherty

It looks like the following line from entrypoint.sh isn't working as of 6.1.0:

    # if environment doesn't exist fail explicitly
    if [ -z "$(amplify env get --name $6 | grep 'No environment found')" ] ; then
      echo "found existing environment $6"
      amplify env pull --yes $9
    else
      echo "$6 environment does not exist, consider using add_env command instead";
      exit 1
    fi

In my local testing, it seems amplify env get checks local envs, not ones in AWS. This env would need to be pulled using amplify pull --envName $ENV_NAME to be able to use amplify env get to get its details.

danieldaugherty avatar Oct 12 '21 18:10 danieldaugherty

why there is no way to specific appid?

huazhouwang avatar Dec 10 '21 05:12 huazhouwang

why there is no way to specific appid?

My question too

whimxiqal avatar Jan 05 '22 22:01 whimxiqal