amazon-archives / awsmobile-cli

CLI experience for Frontend developers in the JavaScript ecosystem.
Apache License 2.0
142 stars 35 forks source link

awsmobile pull returns "you are not working inside a valid awsmobilejs project" #128

Closed thelinuxkid closed 6 years ago

thelinuxkid commented 6 years ago

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

awsmobilejs/.awsmobile/info/project-info.json is needed for an awsmobile pull. But, the repo created by awsmobile start my-project react has a .gitignore file that leaves this file out of the repo. So, when it's cloned the awsmobile pull fails.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than AWS Amplify.

Solution: Including !awsmobilejs/.awsmobile/info/project-info.json, i.e., leaving it out of .gitignore, in the cloned repository fixes the issue.

What is the expected behavior?

awsmobile pull should synchronize the current project

Which versions of Amplify, and which browser / OS are affected by this issue? Did this work in previous versions?

OSX AFAIK

You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = 'DEBUG'; in your app.

UnleashedMind commented 6 years ago

Information about the resources of a specific mobile hub project is considered secret, so they are put in the .gitignore file, and not checked in code repo. After you clone a project to a new environment, please run awsmobile init <mobile-hub-project-id> to link to your backend mobile hub project.

thelinuxkid commented 6 years ago

Thanks for the info. awsmobile init <mobile-hub-project-id> is what I was looking for.

schellack commented 6 years ago

For others stuck on this same issue, the mobile hub project id can be found in the url when you go to https://console.aws.amazon.com/mobilehub and open the project in question. From AWS Amplify Docs:

You can find your Mobile Hub project id in the page URL of the project details page on the AWS Mobile Hub console. The URL looks like https://console.aws.amazon.com/mobilehub/home?region=us-east-1#/xxx-yyy-zzz-aaa-xxx/build and your project id is included in the URL, e.g: xxx-yyy-zzz-aaa-xxx.

askpatrickw commented 5 years ago

@thelinuxkid I think this should be re-opened and the documentation updated.

https://docs.aws.amazon.com/aws-mobile/latest/developerguide/mobile-hub-web-getting-started.html

"The init command creates a backend project for your app. By default, analytics and web hosting are enabled in your backend and this configuration is automatically pulled into your app when you initialize."

should read

"The init command creates a backend project for your app. By default, analytics and web hosting are enabled in your backend and this configuration is automatically pulled into your app when you initialize.

Init is also used to connect your source code to an existing awsmobile backend project and should be used in development."

And the details of how to get the ID from the URL as previously mentioned.

Ideally, I think an additional page of documentation about the developer workflow should be created.