amplify-cli: src/project/amplify/.config/local-env-info.json' error raised when deploy.

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 Error: File at path: '/codebuild/output/src663057245/src/REPO/amplify/.config/local-env-info.json' does not exist error is raised when project is deployed by amplifyPush --simple command.

Amplify CLI Version

  • 4.34.0

To Reproduce Project is connected to github.

  1. merge to dev branch from working branch
  2. Triggers build script
backend:
  phases:
    build:
      commands:
        - chmod +x ./config/backend.sh
        - ./config/backend.sh
frontend:
...
  1. build script is
if [ "${AWS_BRANCH}" = "master" ] || [ "${AWS_BRANCH}" = "dev" ]
then
  echo "BUILD ENV:  ${AWS_BRANCH}"
  npm install -g @aws-amplify/cli
  amplifyPush --simple
else
  echo "BUILD ENV: ${AWS_BRANCH}"
  echo "Not pushing backend"
fi

Expected behavior Deployed successfully

Desktop (please complete the following information): WSL

Additional context

  • Using custom build image mrytkm/amplify-amazonlinux2
  • Log output
2020-11-23T01:44:12.252Z [INFO]: Git SSH Key acquired
2020-11-23T01:44:12.325Z [INFO]: # Cloning repository: git@github.com:TEAM/REPO.git
2020-11-23T01:44:12.338Z [INFO]: Agent pid 129
2020-11-23T01:44:12.344Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2020-11-23T01:44:12.416Z [INFO]: Cloning into 'MYPROJECT'...
2020-11-23T01:44:13.090Z [INFO]: Warning: Permanently added the RSA host key for IP address 'MYIP' to the list of known hosts.
2020-11-23T01:44:16.200Z [INFO]: # Switching to commit: 9bf07fd88ec507104956a3ac7d91e53d681aabef
2020-11-23T01:44:16.331Z [INFO]: Agent pid 142
2020-11-23T01:44:16.335Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2020-11-23T01:44:16.352Z [INFO]: Note: switching to '9bf07fd88ec507104956a3ac7d91e53d681aabef'.
                                 You are in 'detached HEAD' state. You can look around, make experimental
                                 changes and commit them, and you can discard any commits you make in this
                                 state without impacting any branches by switching back to a branch.
                                 If you want to create a new branch to retain commits you create, you may
                                 do so (now or later) by using -c with the switch command. Example:
                                 git switch -c <new-branch-name>
                                 Or undo this operation with:
                                 git switch -
                                 Turn off this advice by setting config variable advice.detachedHead to false
                                 HEAD is now at 9bf07fd Merge pull request #80 from REPO/BRANCH
2020-11-23T01:44:16.359Z [INFO]: Successfully cleaned up Git credentials
2020-11-23T01:44:16.359Z [INFO]: # Checking for Git submodules at: /codebuild/output/src663057245/src/REPO/.gitmodules
2020-11-23T01:44:16.389Z [INFO]: # Retrieving cache...
2020-11-23T01:45:10.883Z [INFO]: # Extracting cache...
2020-11-23T01:46:22.466Z [INFO]: # Extraction completed
2020-11-23T01:46:22.731Z [INFO]: # Retrieving environment cache...
2020-11-23T01:46:22.820Z [INFO]: # Retrieved environment cache
2020-11-23T01:46:22.828Z [INFO]: # Ensuring NPM package '@aws-amplify/cli' is version: 'latest'
2020-11-23T01:46:26.030Z [INFO]: # Patching NPM package '@aws-amplify/cli' from 1.12.0 to 4.34.0...
2020-11-23T01:47:20.904Z [INFO]: # Done patching NPM package '@aws-amplify/cli'
2020-11-23T01:47:25.225Z [INFO]: ## Starting Backend Build
                                 # Starting phase: build
                                 # Executing command: chmod +x ./config/backend.sh
2020-11-23T01:47:25.229Z [INFO]: # Executing command: ./config/backend.sh
2020-11-23T01:47:25.231Z [INFO]: AWS_BRANCH name: dev
2020-11-23T01:47:25.231Z [INFO]: BUILD ENV:  dev
2020-11-23T01:47:25.235Z [INFO]: # Getting Amplify CLI Cloud-Formation stack info from environment cache
2020-11-23T01:47:25.248Z [INFO]: # Start initializing Amplify environment: dev
2020-11-23T01:47:25.248Z [INFO]: {STACK INFO...} 
2020-11-23T01:47:26.347Z [INFO]: File at path: '/codebuild/output/src663057245/src/REPO/amplify/.config/local-env-info.json' does not exist
2020-11-23T01:47:26.348Z [INFO]: Error: File at path: '/codebuild/output/src663057245/src/REPO/amplify/.config/local-env-info.json' does not exist
                                 at Function.JSONUtilities.readJson (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/jsonUtilities.js:40:19)
                                 at StateManager.getData (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/state-manager/stateManager.js:166:56)
                                 at StateManager.getLocalEnvInfo (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/state-manager/stateManager.js:77:25)
                                 at teamProviderInfoGetAuthResourceNameHasSecrets (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/lib/utils/team-provider-migrate.js:44:61)
                                 at Object.exports.migrateTeamProviderInfo (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/lib/utils/team-provider-migrate.js:18:34)
                                 at Object.run (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/lib/index.js:76:45)
                                 at process._tickCallback (internal/process/next_tick.js:68:7)
                                 at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
                                 at startup (internal/bootstrap/node.js:283:19)
                                 at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2020-11-23T01:47:26.355Z [ERROR]: !!! Build failed
2020-11-23T01:47:26.355Z [ERROR]: !!! Non-Zero Exit Code detected
2020-11-23T01:47:26.355Z [INFO]: # Starting environment caching...
2020-11-23T01:47:26.355Z [INFO]: # Uploading environment cache artifact...
2020-11-23T01:47:26.459Z [INFO]: # Environment caching completed
Terminating logging...

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 55 (21 by maintainers)

Most upvoted comments

@hyungjunk @chuongvuoop2021 Hey all I could reproduce we are actively working on a fix now

I have the same issue, the last version working for us is : 4.32.1

Worked for me, thanks.

I just changed config in amplify console => build settings -> Build image settings Screenshot 2020-11-25 at 15 52 22

Dear amplify developers, please check for deploying code created with old version of amplify before release new version. For the last one year working on a project that use amplify I had experienced a similar issue a few times and such a problem is unacceptable for production use of amplify.

Hi all, we are working on a release to fix this problem as soon as possible, I apologize for the issues we are working on it to get the issues addressed as soon as possible.

I have the same issue, the last version working for us is : 4.32.1

The only way I got it working with the 4.41.1 version was creating a local-env-info.json with {} in its content.

Here is the backend section of my build spec with this workaround.

backend:
  phases:
    build:
      commands:
        - echo '{}' > amplify/.config/local-env-info.json
        - amplifyPush --simple

I tested on 4.41.2 and it WORKS without any workaround, but someone else please confirms this.

I just had to downgrade amplify version. You can set in Build settings menu.

@yutaoyan @ammarkarachi 4.41.2 worked when pulling an environment. Success!

The only way I got it working with the 4.41.1 version was creating a local-env-info.json with {} in its content.

any progress? Still building to 4.32, although no hold up

Downgrading to 4.32.1 solved my problem!

my last successful build was with 4.32.1, same as my fail one, I downgraded it back to 4.29.0, and still wouldn’t work, found a workaround by not ignoring amplify/.config/project-config.json though, thanks