Closed libeanim closed 4 years ago
I also tried the workaround suggested in #3094
echo "{ \"projectPath\": \"$(pwd)\", \"envName\": \"${AWS_BRANCH}\"}" > amplify/.config/local-env-info.json
Which then causes this:
$ amplify push
✖ There was an error pulling the backend environment .
An error occured during the push operation: ENOENT: no such file or directory, open 'amplify/team-provider-info.json'
Let me know if you need any additional info.
@libeanim
It seems like your project is in a corrupt state, it does not have the team-provider-info.json file and the local-env-info.json file.
is the project originally setup on the computer you are working on now? or you pulled the codebase from somewhere else?
Could you zip the amplify
folder in your project and send it over to us so we can investigate future?
amplify-cli@amazon.com
I'm also having this issue when I try to run aws amplify start-job --app-id <appid> --branch-name <branchname> --job-type RELEASE
for a specific branch.
I've run amplify init
again and selected my existing dev
environment but every time I try to run the release command for my branch I'm getting this error
Any help would be much appreciated
Update: I've now tried the following (my branch name is notification-lambda
:
Deleting the branch using aws amplify delete-branch --app-id <appid> --branch-name <branchname>
Recreating the branch with aws amplify create-branch --app-id <appid> --branch-name <branchname>
(Still got the same error)
Creating a new branch off my current branch called notification-lambda-2
and running the RELEASE
command (Didn't work)
So now I've deleted the new branch notification-lambda-2
and switched back to the original and tried to create/release again. But now the build is failing and giving me the following error:
{ AlreadyExistsException: Stack [amplify-spiritual-growth-notificati-161138] already exists
Something strange I noticed is that there is a difference in the name of the Frontend and Backend environments for my branch. The frontend has the correct name notification-lambda
, but the backend has only notificati
, so the name seems to get cut off somehow. I tried to delete the backend environment through the console which says to run amplify env remove notificati
, but when I run that I just get No environment found with the corresponding name provided
which makes sense since I don't have an environment with that name. The only environment I have is dev
.
I wish I could just delete the backend environment named notificati
so I could start fresh but I'm not able to.
@UnleashedMind Thanks for your help, I sent an email with the zipped amplify folder.
The project was originally created on this computer and was also under version control since. However it was created a year ago with an older amplify-cli version. (I just recently upgraded to the newest version).
Is it possible that the team-provider-info.json file and the local-env-info.json file did not exist back then?
I had something similar when I upgraded from 1.x to 4.x and the command amplify configure project
created/updated the correct files for me - have tried that?
I'm facing the same issue for a project created with version 4.5 after upgrading to 4.12
I do have a team-provider-info.json file locally, and PR previews were working before upgrading the CLI version.
I believe this is a bug in recent versions of the CLI, and I can't downgrade to older versions because they create lambda functions with the node8 runtime which does not work anymore.
@olivoil I've just pinned mine to 4.11.0 and that includes nodejs10.x runtime. My project is now fully working both locally and within Amplify Console:
excerpt amplify.yml
version: 0.1
backend:
phases:
preBuild:
commands:
- npm install -g @aws-amplify/cli@4.11.0 # pinned known working version
@olivoil Your issue is probably different from @libeanim 's , although the error message is the same. There's a PR out already for the issue you had.
Thank you @heitorlessa, it looks like pinning down the version to 4.11.0 works the first time it deploys a PR preview.
2020-01-17T05:18:39.240Z [WARNING]: ✔ All resources are updated in the cloud
2020-01-17T05:18:39.242Z [INFO]: GraphQL endpoint: https://[redacted]
2020-01-17T05:18:39.244Z [INFO]:
2020-01-17T05:18:39.293Z [INFO]: Initialized your environment successfully.
2020-01-17T05:18:39.295Z [INFO]: Your project has been successfully initialized and connected to the cloud!
Some next steps:
"amplify status" will show you what you've added already and if it's locally configured or deployed
"amplify <category> add" will allow you to add features like user login or a backend API
"amplify push" will build all your local backend resources and provision it in the cloud
“amplify console” to open the Amplify Console and view your project status
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
Pro tip:
Try "amplify add api" to create a backend API and then "amplify publish" to deploy everything
2020-01-17T05:18:39.369Z [INFO]: # Environment prba details:
2020-01-17T05:18:39.866Z [INFO]:
2020-01-17T05:18:39.867Z [INFO]: prba
2020-01-17T05:18:39.868Z [INFO]: --------------
[redacted]
--------------
Provider: categories
2020-01-17T05:18:39.868Z [INFO]: auth: [object Object]
function: [object Object]
--------------
2020-01-17T05:18:39.900Z [INFO]: # Done initializing Amplify environment: prba
2020-01-17T05:18:39.902Z [INFO]: # Store Amplify CLI Cloud-Formation stack info in environment cache
But if I push new commits to the PR, the preview fails again with the same error message:
# Importing Amplify environment: prba (amplify env import)
2020-01-17T05:31:00.636Z [INFO]: Scanning for plugins...
2020-01-17T05:31:03.717Z [INFO]: Plugin scan successful
2020-01-17T05:31:03.741Z [INFO]: Successfully added environment from your project
2020-01-17T05:31:03.784Z [INFO]: # Initializing existing Amplify environment: prba (amplify init)
2020-01-17T05:31:04.294Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2020-01-17T05:31:06.966Z [INFO]: init failed
2020-01-17T05:31:06.970Z [INFO]: { UndeterminedEnvironmentError: Current environment cannot be determined
Use 'amplify init' in the root of your app directory to initialize your project with Amplify
at getEnvInfo (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/get-env-info.js:19:15)
at AmplifyToolkit.getProjectDetails [as _getProjectDetails] (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/get-project-details.js:14:26)
at Object.run (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/amplify-service-migrate.js:9:42)
at Object.run (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/initializer.js:80:33)
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) name: 'UndeterminedEnvironmentError' }
It fails only with PR previews, not environments connected to branches
Thanks @UnleashedMind, good to know. I'll test when the PR is merged to confirm
amplify configure project
created/updated the correct file
This worked for me. Thanks
I am getting this same error:
2020-01-19T14:36:25.870Z [INFO]: # Initializing existing Amplify environment: master (amplify init)
2020-01-19T14:36:26.345Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2020-01-19T14:36:28.826Z [INFO]: init failed
2020-01-19T14:36:28.829Z [INFO]: UndeterminedEnvironmentError: Current environment cannot be determined
Use 'amplify init' in the root of your app directory to initialize your project with Amplify
at getEnvInfo (/root/.nvm/versions/node/v12.8.1/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/get-env-info.js:19:15)
at AmplifyToolkit.getProjectDetails [as _getProjectDetails] (/root/.nvm/versions/node/v12.8.1/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/get-project-details.js:14:26)
at Object.run (/root/.nvm/versions/node/v12.8.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/amplify-service-migrate.js:9:42)
at Object.run (/root/.nvm/versions/node/v12.8.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/initializer.js:80:33) {
name: 'UndeterminedEnvironmentError'
}
This works perfectly fine locally though and I can push just fine and everything is working exactly as intended. But as soon as I start a build the backend fails to build.
I tried everything mentioned here and no dice. This is my build file:
version: 0.1
backend:
phases:
preBuild:
commands:
- npm install -g @aws-amplify/cli@4.12.0 # pinned known working version
build:
commands:
- '# Get Amplify CLI Cloud-Formation stack info from environment cache'
- export STACKINFO="$(envCache --get stackInfo)"
- '# Execute Amplify CLI with the helper script'
- amplifyPush --environment $AWS_BRANCH
- '# Store Amplify CLI Cloud-Formation stack info in environment cache'
- envCache --set stackInfo "$(amplify env get --json --name $AWS_BRANCH)"
frontend:
phases:
preBuild:
commands:
- npm install
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
Peter - Change to 4.11.0 under your preBuild section and it should work
On Sun, 19 Jan 2020 at 14:43, Peter Elmegaard notifications@github.com wrote:
I am getting this same error:
2020-01-19T14:36:25.870Z [INFO]: # Initializing existing Amplify environment: master (amplify init) 2020-01-19T14:36:26.345Z [INFO]: Note: It is recommended to run this command from the root of your app directory 2020-01-19T14:36:28.826Z [INFO]: init failed 2020-01-19T14:36:28.829Z [INFO]: UndeterminedEnvironmentError: Current environment cannot be determined Use 'amplify init' in the root of your app directory to initialize your project with Amplify at getEnvInfo (/root/.nvm/versions/node/v12.8.1/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/get-env-info.js:19:15) at AmplifyToolkit.getProjectDetails [as _getProjectDetails] (/root/.nvm/versions/node/v12.8.1/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/get-project-details.js:14:26) at Object.run (/root/.nvm/versions/node/v12.8.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/amplify-service-migrate.js:9:42) at Object.run (/root/.nvm/versions/node/v12.8.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/initializer.js:80:33) { name: 'UndeterminedEnvironmentError' }
This works perfectly fine locally though and I can push just fine and everything is working exactly as intended. But as soon as I start a build the backend fails to build.
I tried everything mentioned here and no dice. This is my build file:
version: 0.1 backend: phases: preBuild: commands:
- npm install -g @aws-amplify/cli@4.12.0 # pinned known working version build: commands:
- '# Get Amplify CLI Cloud-Formation stack info from environment cache'
- export STACKINFO="$(envCache --get stackInfo)"
- '# Execute Amplify CLI with the helper script'
- amplifyPush --environment $AWS_BRANCH
- '# Store Amplify CLI Cloud-Formation stack info in environment cache'
- envCache --set stackInfo "$(amplify env get --json --name $AWS_BRANCH)" frontend: phases: preBuild: commands:
- npm install
- npm ci build: commands:
- npm run build artifacts: baseDirectory: build files:
- '*/' cache: paths:
- node_modules/*/
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-cli/issues/3161?email_source=notifications&email_token=AAZPQBHDAL5OYGOKVJFEM3DQ6RRIBA5CNFSM4KFK7JA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJKTZ6I#issuecomment-576011513, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZPQBDMOCETPQA6ISHZUKTQ6RRIBANCNFSM4KFK7JAQ .
I am getting the same issue with 4.11.0. I use 4.12.0 locally and that seemed to work so I tried that.
I had the same issue with 4.12 - works locally but not in Amplify Console. Changed to 4.11 in the build settings and it’s working since last week with multiple builds and envs
On Sun, 19 Jan 2020 at 17:01, Peter Elmegaard notifications@github.com wrote:
I am getting the same issue with 4.11.0. I use 4.12.0 locally and that seemed to work so I tried that.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-cli/issues/3161?email_source=notifications&email_token=AAZPQBHGE67RKFWSHT6XPXTQ6SBOVA5CNFSM4KFK7JA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJKXADQ#issuecomment-576024590, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZPQBGQ2QUG2RJMXYQPKWDQ6SBOVANCNFSM4KFK7JAQ .
Doesn't seem to work for me, could the version be cached or something?
Possibly. To rule that out, comment that line in preBuild and use the Live Packages features that is handled at the container build lifecycle:
https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-image.html
Here’s my custom build setup just in case
https://github.com/aws-samples/aws-serverless-airline-booking/blob/develop/amplify.yml
On Sun, 19 Jan 2020 at 17:16, Peter Elmegaard notifications@github.com wrote:
Doesn't seem to work for me, could the version be cached or something?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-cli/issues/3161?email_source=notifications&email_token=AAZPQBBBTUXA6UF3JOLOCBDQ6SDGJA5CNFSM4KFK7JA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJKXKLQ#issuecomment-576025902, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZPQBFER6SBDGSEJZXALZLQ6SDGJANCNFSM4KFK7JAQ .
I have overridden the amplify cli version in build settings and that fixed the issue. Thank you very much.
Followed the same steps above to pin to 4.11 and it worked, 4.12 is currently broken
@davekiss 4.13.1 should have the fix for this.
@kaustavghosh06 I'm currently getting this error with v4.16.1
@UnleashedMind I have just moved to a new machine and my project was running beautifully on the new machiine(with Api, Auth, Storage services via Amplify). I realised i needed to interact with amplify-cli, so I then installed npm install -g @aws-amplify/cli
. I ran amplify status:
| Category | Resource name | Operation | Provider plugin |
| -------- | ------------- | --------- | ----------------- |
| Api | project | Update | awscloudformation | <-strangely updated?
| Auth | project837477 | No Change | awscloudformation |
| Storage | projectStorage | No Change | awscloudformation |
Strangely Api updated even though i've made no changes. Anyway, when i ran amplify push
, i got the following error.
An error occurred during the push operation: ENOENT: no such file or directory, team-provider-info.json'
. This file exists, just as it did in my project folder on my last machine.
Then i tried npm install -g @aws-amplify/cli@4.11.0
but still no luck to push. What on earth is going on? I'm paralyzed in my tracks right now and i have to kick on and complete this project. Please help!!
Running amplify init
from the root project's directory has solved the issue for me.
My issue started when I tried to work on an old project that was initialized by an old version of Amplify CLI.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels for those types of questions.
I recently updated the amplify cli and now when running
amplify push
in my project I receive following error:Running
amplify init
again returns following:After that I still cannot run
amplify push
. Unfortunately I also can't remember what the previous version of amplify cli was I used. Otherwise I would have gone back to that version.Whats the best way to fix that? The only option I see at the moment is to create a new amplify project, then run
amplify add api
, copy theschema.graphl
to the new amplify project and then link the AppSync Data Sources to the old dynamo db tables.Amplify CLI Version
4.12.0
What AWS Services are you utilizing?
Cognito, AppSync (DynamoDB)
Provide additional details e.g. code snippets