2
votes

I'm picking up development started by another team on a Vue.js app with AWS Amplify. They used Amplify Cli to add Auth to the app.

I've pulled the project down from GitHub. When I run the app, the Auth service is working fine.

I'm now trying to add Storage with amplify add storage, but am struggling to get the Amplify Cli (which I've had working fine on my own projects) to work with the new project.

I've tried:

  • amplify configure project, which fails with the message 'You are not working inside a valid Amplify project. Use 'amplify init' in the root of your app directory to initialize your project, or 'amplify pull' to pull down an existing project.' (but I don't want to init a new project, this is an existing project that I've git pulled)
  • amplify pull --appId myAppIDFromTheAmplifyConsole --envName dev, which fails with the message 'File at path: '/[thefullpath]/amplify/.config/local-env-info.json' does not exist' (and I can see that that file doesn't exist. The other team have confirmed that the file has never existed.)

My questions are:

  1. Should I run amplify init as the first bullet point error message suggests? The auth service is working and I don't want to break the existing cognito user pools that Amplify created. Will amplify init push or rerun the cloudformation scripts and therefore change the backend?
  2. If I shouldn't, what should I do?

Thanks!

2

2 Answers

2
votes

The question without an answer, so I'll answer for future visitors.
You need to run amplify init after amplify configure, it will initialize a project and associate your local project with a cloud environment. amplify init will ask questions and after answering them, /[thefullpath]/amplify/.config/local-env-info.json file will be created. local-env-info.json should be in .gitignore file, because it contains information about the locally initialized environment.

Note: amplify init will not push your changes to the cloud

1
votes
  1. Make sure you have the Amplify CLI installed, amplify version checking: amplify --version
  2. On the project folder run: amplify pull --appId [your app id] --envName [environment name]
  3. After you run the above command it will ask: aws region, select the region where your amplify project uploaded, next--> enter AWS access key and AWS secret key once amplify pull is a success, you are done, now you can add more service you want.