12

How can I solve the issue of "No Amplify backend project files detected within this folder. Either initialize a new Amplify project or pull an existing project" Am always having this issue on Windows with Amplify. I am following the TindeClone, just for me to come back to it after I took a break I got "Could not attach the backend to the project. Ensure that there are no applications locking the amplify folder and try again". These issues are frustrating me how how do I solve it and move on. Here's the screenshot enter image description here

Thanks for you kind response.

Benjamin Ikwuagwu
  • 377
  • 1
  • 9
  • 28

4 Answers4

5

Simple delete the amplify folder in your project run this amplify pull --appId xxxxx --envName xxxx

and when asked for Do you want changes backend select yes

This worked for me!

  • This one should be the accepted answer. It doesn't require deleting and recreating anything, and it includes the only step I missed. Namely, the question about backend changes is misleading. If you answer `No` it doesn't create a local backend and many commands such as `amplify export` don't work. – nponeccop May 13 '23 at 13:42
3

Are you sure you have "amplify" folder one step inside the "TinderClone" folder?

Amplify cli could not locate an amplify folder inside TinderClone.

Try `amplify pull with these steps IN A NEW EMPTY FOLDER.

$ amplify pull
? Select the authentication method you want to use: AWS profile
? Please choose the profile you want to use: (Use arrow keys)
? Please choose the profile you want to use: default
? Which app are you working on? (Use arrow keys)
> amplifyapp (XXXXXXXXXXXXX)
  amplifyapp (XXXXXXXXXXXXX)
  newsBot (XXXXXXXXXXXXX)
  TodoApp (XXXXXXXXXXXXX)               
  ImageDownloader (XXXXXXXXXXXXX)

it'll fetches resources from the cloud.

Let me know what happened.

Waleed Ahmad
  • 446
  • 3
  • 15
  • Hi @Waleed Ahmad, thank you for your kind response. I have tried "amplify pull" but it still gave me the same error message ''Could not attach the backend to the project. Ensure that there are no applications locking the `amplify` folder and try again". What could be the problem? And how can I avoid it happening again? – Benjamin Ikwuagwu Sep 27 '21 at 22:01
  • I tried running `amplify init` again, I discovered in my amplify folder /backend/backend-config.jason does not exist again. But I had it before, what could make it disappear? – Benjamin Ikwuagwu Sep 27 '21 at 22:19
0

Edit: take special note of Dylan's comment below:

This will erase the amplify project and resources in the cloud, then re-create. You can view instructions how to re-pull the existing environment within the amplify console under the "backend environments tab".

amplify pull --appId {amplify app id} --envName {env name}

I was just recently struggling with the same blocker, after creating/deploying/testing an AWS Amplify project in my personal profile, I added a profile for my "client" (in this case, my brother), who created a specific AWS IAM user for me in his account.

The solution that I discovered, as per this AWS blog post, was to do the following from inside my project root folder:

  1. (if not already done) remove the currently deployed Amplify stack, using amplify delete
  2. delete the local "deployment information" file, using rm amplify/team-provider.info.json
  3. re-initialise a new AWS Amplify stack (i.e.: in the cloud) and generate the relevant local files for it, using amplify init
    • be sure to select the correct AWS profile or Key here for the new deployment, adding a new one if required..
  4. push your project to the newly initialised AWS Amplify stack, using amplify push for backend-only, or using amplify publish if you use Amplify Hosting

Disclaimer: as I'm still learning AWS, so I may possibly use incorrect terms and/or examples to explain what I've learnt. This answer is most definitely open to clarification by the community.. Either way, I hope it helps.

Andre Greeff
  • 121
  • 5
  • 1
    This will erase the amplify project and resources in the cloud, then re-create. You can view instructions how to re-pull the existing environment within the amplify console under the "backend environments tab" `amplify pull --appId {amplify app id} --envName {env name}` – Dylan w Jan 25 '23 at 23:02
0

Make sure that the .config file exists inside the amplify folder. It contains all the required configuration files.

enter image description here