question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running amplify init to create a new environment doesn't update your local environment settings

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
mattfyshcommented, Oct 7, 2021

@giulioambrogi you can amplify env checkout ENV

0reactions
aaronjwhipple87commented, Jul 20, 2022

This is still occurring cli version: 9.1.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Team environments - Overview - AWS Amplify Docs
Run amplify env add and set up a new environment (e.g. "mydev") with that developer's account and AWS profile; Deploy with amplify push....
Read more >
Error initializing environment after running "amplify init."
Solution: Try using a different name for the environment instead of dev and see if that works. In my case it solved such...
Read more >
Configuring build settings - AWS Amplify Hosting
You can configure Amplify Hosting to use diff based backend builds using the AMPLIFY_DIFF_BACKEND environment variable. When you enable diff based backend ...
Read more >
Multiple Environments with AWS Amplify - Jan Hesters
amplify init. # highlight-end. Note: It is recommended to run this command from the root of your app directory ? Enter a name...
Read more >
If you use Amplify and Git branches, you are going to have a ...
After you created a backend environment dev and deployed it, Amplify considers it as the equivalent of Git remote . When you want...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found