Running amplify init to create a new environment doesn't update your local environment settings
See original GitHub issueDescribe the bug
Using an existing app I created a new environment using amplify init
as described in https://docs.amplify.aws/cli/teams/overview
However although this created a new environment and I pushed it. When running my App locally my API’s are still pointing at the old environment. To reset it I then had to do a amplify pull
which changed the files to use the correct environment rather than the previous one.
Amplify CLI Version
v4.41.2
To Reproduce
Assuming an existing app that is already in the cloud:
- run
amplify init
and within the steps for that: ** Don’t base it on an existing environment ** Give it a name ** Select the existing environment as the source to copy from - run
amplify push
- Run your app in the browser
- Check the contents of awsexports.js and note that all the endpoints for your API’s are still pointing to the old one.
Expected behavior
After creating a new environment and pushing it I would expect it to update my current environment to match it.
I guess this is like git’s “create a new branch” command which annoyingly then never actually checks out that new branch?
This might be by design but it lost me about 50 minutes of head scratching today, could cost someone else coming be hind us a lot more, lets make it simpler.
- OS: Windows
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:10 (3 by maintainers)
@giulioambrogi you can
amplify env checkout ENV
This is still occurring cli version: 9.1.0