Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the
Amplify Console GitHub Issue Tracker
Describe the bug
After checking out the master branch and fixing issues setting up the master env based on the develop environment, I switched back to the develop env to find a bunch of errors stopping me from checking out the env.
1.
```app on î‚ develop [⇡$] is 📦 v0.1.0 via ⬢ v12.11.1
✦ ➜ amplify env checkout develop
Current environment cannot be determined
Use 'amplify init' in the root of your app directory to initialize your project with Amplify
UndeterminedEnvironmentError: Current environment cannot be determined
Use 'amplify init' in the root of your app directory to initialize your project with Amplify
at getEnvInfo (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/get-env-info.js:18:15)
at Object.run (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/lib/commands/env/checkout.js:17:30)
at Object.run (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/lib/commands/env.js:25:37)
at Object.executeAmplifyCommand (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/lib/index.js:110:25)
at executePluginModuleCommand (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/lib/execution-manager.js:131:32)
at async Object.executeCommand (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/lib/execution-manager.js:16:9)
at async Object.run (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/lib/index.js:54:9)
2.
app on î‚ develop [⇡$] is 📦 v0.1.0 via ⬢ v12.11.1
✦ ➜ amplify status
| Category | Resource name | Operation | Provider plugin |
| ------------------------ | -------------------------------------- | --------- | ----------------- |
| Auth | xxxxxxxxxxx | Create | awscloudformation |
| Auth | userPoolGroups | Create | awscloudformation |
| Function | xxxxxxxxxxx | Create | awscloudformation |
| Function | xxxxxxxxxxx | Create | awscloudformation |
| Function | xxxxxxxxxxx | Create | awscloudformation |
| Function | xxxxxxxxxxx | Create | awscloudformation |
| Function | xxxxxxxxxxx | Create | awscloudformation |
| Function | xxxxxxxxxxx | Create | awscloudformation |
| Function | xxxxxxxxxxx | Create | awscloudformation |
| Function | xxxxxxxxxxx | Create | awscloudformation |
| Function | xxxxxxxxxxx | Create | awscloudformation |
| Storage | xxxxxxxxxxx | Create | awscloudformation |
| Hosting | S3AndCloudFront | Create | awscloudformation |
| Api | xxxxxxxxxxx | Create | awscloudformation |
| Api | xxxxxxxxxxx | Create | awscloudformation |
| Analytics | xxxxxxxxxxx | Create | awscloudformation |
| Lambdatriggerpermissions | xxxxxxxxxxx | Create | awscloudformation |
ENOENT: no such file or directory, open '/home/acidburn/Documents/xxxxxxxxxxx.app/xxxxxxxxxxx.app/amplify/backend/amplify-meta.json'
Error: ENOENT: no such file or directory, open '/home/acidburn/Documents/xxxxxxxxxxx.app/xxxxxxxxxxx.app/amplify/backend/amplify-meta.json'
at Object.openSync (fs.js:451:3)
at Object.readFileSync (fs.js:353:35)
at readJsonFile (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/read-json-file.js:14:33)
at AmplifyToolkit.getProjectMeta [as _getProjectMeta] (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/get-project-meta.js:6:23)
at showPinpointURL (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/display-helpful-urls.js:20:41)
at displayHelpfulURLs (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/display-helpful-urls.js:6:3)
at Object.showHelpfulLinks (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/index.js:83:10)
at /home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/show-helpful-provider-links.js:14:40
at Array.forEach (
at AmplifyToolkit.showHelpfulProviderLinks [as _showHelpfulProviderLinks] (/home/acidburn/.nvm/versions/node/v12.11.1/lib/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/show-helpful-provider-links.js:12:13)
acidburn@gibson
```
So then I added back in the amplify-meta.json file and then also the local-env-info.json file that another issue on here mentioned to exclude via .gitignore to stop merge conflicts and then run
amplify env checkout develop again and all seems well. What am I doing wrong here? I would like to be able to go between environments quickly without fixing merge conflicts every time and having to add back in gitignored files
Amplify CLI Version
4.21.0
To Reproduce
As above
Expected behavior
I would like to be able to go between environments quickly without fixing merge conflicts every time and having to add back in gitignored files
Desktop (please complete the following information):
Thanks in advance,
@kylekirkby I see that something went off for sure in your case, and currently also gathering more information around team workflow issues in #4587 if you can help provide complete repro steps including git and amplify commands that would enable is to see if it is a workflow problem on your end or an actual code problem.
Also share any feedback about the merge conflicts, what files are usually affected any specific sections? How can we make documentation better.
@attilah I'm going to be merging some changes over into my production branch / env this weekend.
I'll let you know if I come across the same / other issues surrounding multi environments. Do you have the list of files that should be in the .gitignore listed some place for reference? Not entirely sure why I didn't keep the .gitignore they way it was when I ran amplify init 4 months ago! Just checked my team-provider-info.json file and I've only got the develop env currently; shouldn't this have the master env too?
Hi @kylekirkby ,
Do you have the list of files that should be in the .gitignore listed some place for reference?
You can find the reference to Amplify CLI's .gitignore here