Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prod environment does not exist, consider using add_env command instead #14

Open
hamzajaved12 opened this issue Jan 21, 2021 · 6 comments

Comments

@hamzajaved12
Copy link

No description provided.

@hamzajaved12
Copy link
Author

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

@sar
Copy link

sar commented Jun 22, 2021

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/amplify-cli-action@0.3.0
      with:
        amplify_command: configure
        amplify_env: prod       # Environment name that exists in CloudFormation Amplify target

    - name: deploy
      uses: ambientlight/amplify-cli-action@0.3.0
      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.

@danieldaugherty
Copy link

danieldaugherty commented Oct 12, 2021

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/amplify-cli-action@0.3.0
        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
Copy link

danieldaugherty commented Oct 12, 2021

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.

@huazhouwang
Copy link

why there is no way to specific appid?

@whimxiqal
Copy link

why there is no way to specific appid?

My question too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants