amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

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

Open hyungjunk opened this issue 6 years ago • 55 comments

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: [email protected]: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...

hyungjunk avatar Nov 23 '20 03:11 hyungjunk

I have the same issue, anyone finds a workaround yet?

chuongvuoop2021 avatar Nov 23 '20 09:11 chuongvuoop2021

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

hyungjunk avatar Nov 23 '20 09:11 hyungjunk

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

which version do you use?

chuongvuoop2021 avatar Nov 23 '20 10:11 chuongvuoop2021

It is 4.29.x

Can't rememeber precisely but pretty sure it wont be a big matter.

I recommend checking out the last successful build log of your project and use the same version. Thats what I did.

hyungjunk avatar Nov 23 '20 10:11 hyungjunk

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

chuongvuoop2021 avatar Nov 23 '20 11:11 chuongvuoop2021

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

ammarkarachi avatar Nov 23 '20 22:11 ammarkarachi

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

jjborie avatar Nov 24 '20 23:11 jjborie

Same here! Since yesterday morning. I tried by not ignoring amplify/.config/project-config.json but when I push to my production branch it gets stucked

javieramirez90 avatar Nov 24 '20 23:11 javieramirez90

I had the same issue on 4.34.0 what fixed it for me was changing the Build image settings to use the latest Amplify cli because the default version seems to be older than the latest, previously I was updating the amplify cli as part of my build script but that wasn't working anymore. Also 4.34.0 has changed were the some information is located, I think you have to run any amplify command to make this change to your project I ran amplify --version in the root of my project and the dialog to update the files started. Also setup a service role if you haven's already

Roya1jr avatar Nov 25 '20 06:11 Roya1jr

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.

aveeday avatar Nov 25 '20 14:11 aveeday

A fix has been released in Amplify CLI version 4.36.1. If you still see this issue, please comment below and we will re-open.

jhockett avatar Nov 27 '20 21:11 jhockett

same problem as before. However, I am able to build up to 4.32 by adjusting build settings. It fails on 4.32.1 during back end build. I have at least an operating system. What should I do next? log (85).txt

drclohite avatar Nov 28 '20 16:11 drclohite

Reopen this issue

I have updated the amplify cli version to 4.36.2. This issue is still happening. Whatever the fix was, clearly its not working.

sky4git avatar Nov 29 '20 06:11 sky4git

I also still have this problem on 4.36.2.

nickamckenna avatar Nov 29 '20 16:11 nickamckenna

@drclohite @nickamckenna What's the error you see?

ammarkarachi avatar Nov 29 '20 20:11 ammarkarachi

https://github.com/aws-amplify/amplify-cli/issues/5974 @drclohite your issue is somewhat identical to the issue mentioned here +1 or follow up the thread there

ammarkarachi avatar Nov 29 '20 20:11 ammarkarachi

Reopen this issue again

The issue is not identical. #5974 happens when using amplify env checkout dev command.

However, this happens with amplifyPush --simple in amplify.yml. This is a more urgent issue than the other one, as currently it stops the production deployment pipeline.
We have this simple command to push our changes to production using our production deployment script in amplify.yml. We have noticed this issue with the latest amplify cli update. Currently, we cant deploy to production as it always fails.

Either give some work around or fix this issue. Please do not close this issue without proper solution.

Issue is exactly the same as describe in very first comment.

sky4git avatar Nov 29 '20 23:11 sky4git

@sky4git Can you share the log output?

ammarkarachi avatar Nov 29 '20 23:11 ammarkarachi

2020-11-29T06:25:12.623Z [INFO]: # Executing command: amplify --version 2020-11-29T06:25:13.646Z [INFO]: Initializing new Amplify CLI version... 2020-11-29T06:25:13.939Z [INFO]: Done initializing new version. 2020-11-29T06:25:13.939Z [INFO]: Scanning for plugins... 2020-11-29T06:25:13.973Z [INFO]: Plugin scan successful 2020-11-29T06:25:14.006Z [INFO]: File at path: '/codebuild/output/src654173097/src/MYPROJECTNAME/amplify/.config/local-env-info.json' does not exist 2020-11-29T06:25:14.006Z [INFO]: Error: File at path: '/codebuild/output/src654173097/src/MYPROJECTNAME/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:39: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:78:45) 2020-11-29T06:25:14.013Z [ERROR]: !!! Build failed 2020-11-29T06:25:14.013Z [ERROR]: !!! Non-Zero Exit Code detected

sky4git avatar Nov 29 '20 23:11 sky4git

@sky4git Can you try changing your amplify CLI version in the console to 4.32.1? https://github.com/aws-amplify/amplify-cli/issues/5931#issuecomment-733724542

jhockett avatar Nov 29 '20 23:11 jhockett