Skip to content

When using slc loopback:relation, I get [object Promise] error #2392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
subchal opened this issue May 31, 2016 · 15 comments
Closed

When using slc loopback:relation, I get [object Promise] error #2392

subchal opened this issue May 31, 2016 · 15 comments
Assignees
Labels

Comments

@subchal
Copy link

subchal commented May 31, 2016

Hi good morning everyone,

I am on Windows 7. and npm version is 3.6.0. I was trying to play with slc loopback:relation concept. Whenever, I try to establish a has-many relationship between two models, I run into the [object Promise] showing up in red color at the point where I was prompted to enter the name of the relationship. I spent several hours trying to figure out what may be causing the issue.

Below is the example that I was trying to do - Please see the last line, where it says, [object Promise] - I am not able to get past this issue no matter whatever I enter.

Any clues will be greatly appreciated

C:\sairam\OMSaiRamC\FullStack\Session - 5\Week 4\loopback-server>slc loopback:model
? Enter the model name: Test1
? Select the data-source to attach undefined to: MongoDB (mongodb)
? Select model's base class PersistedModel
? Expose Test2 via the REST API? Yes
? Custom plural form (used to build REST URL):
? Common model or server only? common
Let's add some Test1 properties now.

Enter an empty property name when done.
? Property name: Name
   invoke   loopback:property
? Property type: string
? Required? Yes
? Default value[leave blank for none]:

Let's add another Test1 property.
Enter an empty property name when done.
? Property name: Description
   invoke   loopback:property
? Property type: string
? Required? Yes
? Default value[leave blank for none]:

Let's add another Test1 property.
Enter an empty property name when done.
? Property name:


C:\sairam\OMSaiRamC\FullStack\Session - 5\Week 4\loopback-server>slc loopback:model
? Enter the model name: Test2
? Select the data-source to attach undefined to: MongoDB (mongodb)
? Select model's base class PersistedModel
? Expose Test2 via the REST API? Yes
? Custom plural form (used to build REST URL):
? Common model or server only? common
Let's add some Test2 properties now.

Enter an empty property name when done.
? Property name: Price
   invoke   loopback:property
? Property type: string
? Required? Yes
? Default value[leave blank for none]:

Let's add another Test2 property.
Enter an empty property name when done.
? Property name: Label
   invoke   loopback:property
? Property type: string
? Required? Yes
? Default value[leave blank for none]:

Let's add another Test2 property.
Enter an empty property name when done.
? Property name:


C:\sairam\OMSaiRamC\FullStack\Session - 5\Week 4\loopback-server>slc loopback:relation
? Select the model to create the relationship from: Test1
? Relation type: has many
? Choose a model to create a relationship with: Test2
? Enter the property name for the relation: (test2s)
>> [object Promise]
@gunjpan gunjpan self-assigned this May 31, 2016
@gunjpan
Copy link
Contributor

gunjpan commented May 31, 2016

@subchal : Hi, could you please let me know what strongloop version you have:
you can grab the output of slc -v and post it here for me.

@subchal
Copy link
Author

subchal commented May 31, 2016

Hi Good morning, please see below

C:\sairam\OMSaiRamC\FullStack\Session - 5\Week 4\loopback-server2>npm -v
3.6.0

C:\sairam\OMSaiRamC\FullStack\Session - 5\Week 4\loopback-server2>slc -v
strongloop v6.0.1 (node v5.7.0)
├── [email protected] (fb756f2)
├── [email protected] (a98f310)
├── [email protected] (9b29df0)
├── [email protected] (62e539b)
├── [email protected] (6ab604c)
├── [email protected] (f8c2339)
├── [email protected] (28c261d)
├─┬ [email protected]
│ └── [email protected] (ec2d95b)
├── [email protected] (81311b3)
├── [email protected]
└── [email protected]

@subchal
Copy link
Author

subchal commented May 31, 2016

Hi Good afternoon, just checking to see if you need any further information and any anticipated time frame on when you may be able to suggest next steps. Thanks in advance.

@subchal
Copy link
Author

subchal commented Jun 1, 2016

Hi Good morning Gunipan, Just checking if you have any further guidance on the above noted issue ?

@gunjpan
Copy link
Contributor

gunjpan commented Jun 1, 2016

@subchal : That seems to be a bug as I can reproduce it. We will update you on the status when it's fixed.
Meanwhile, would you like to submit a patch.

@gunjpan gunjpan added bug and removed triaging labels Jun 1, 2016
@subchal
Copy link
Author

subchal commented Jun 1, 2016

Hi Gunjpan good morning - Unfortunately, I don't know how to fix it. Hence, I won't be able to submit a patch. In the meanwhile, Is there a previous version of the connector, for MongoDB, that is available for me to use ? Also, can you please let me know how long it will take to fix the bug ? Please let me know. Thanks for your help

@gunjpan
Copy link
Contributor

gunjpan commented Jun 1, 2016

@subchal : It's fixed here: strongloop/generator-loopback#192
It's fixed, not sure if it's released on npm, you can directly install generator-loopback from GH repo

@gunjpan
Copy link
Contributor

gunjpan commented Jun 1, 2016

@subchal: it's not connector specific, it was an issue with the relation generator. If you like, you can create hasMany relation programmatically as well, more here

@subchal
Copy link
Author

subchal commented Jun 1, 2016

Hi Good morning Gunjpan,

I see above "@subchal : It's fixed here: strongloop/generator-loopback#192
It's fixed, not sure if it's released on npm, you can directly install generator-loopback from GH repo" -

Can you please provide further instructions, such as, do I need to do npm uninstall loopback-connector-mongodb first, before I do npm install generator-loopback ? Also, I am bit new to Git REpo. Trying to figure out how to do the install directly from Git Repo. Any pointers will be greatly appreciated.

@ssh24
Copy link
Contributor

ssh24 commented Jun 1, 2016

Verified.

Verification steps:

  • Create a slc loopback app
  • Create two models test1 and test2 using slc loopback:model
  • Create a has many relationship between test1 and test2 using slc loopback:relation as shown below:

010616 -bash 80x24 terminal today at 10 46 09 am

@subchal
Copy link
Author

subchal commented Jun 1, 2016

Hi ssh24 good morning - Can you please provide some instructions on how i can get this fix onto my local workstation ? Can you please provide further instructions, such as, do I need to do npm uninstall loopback-connector-mongodb first, before I do npm install generator-loopback ? Also, I am bit new to Git REpo. Trying to figure out how to do the install directly from Git Repo. Any pointers will be greatly appreciated.

@gunjpan
Copy link
Contributor

gunjpan commented Jun 1, 2016

@subchal: Install generator-loopback from its gitHub repo using npm. See how to do it here

Can you please provide further instructions, such as, do I need to do npm uninstall loopback-connector-mongodb first, before I do npm install generator-loopback

NO. you just need to install generator-loopback as that's the piece was broken.

@subchal
Copy link
Author

subchal commented Jun 1, 2016

He good morning Gunjpan thank you. Do you know when the fix will make its way I I the npm registry?

@gunjpan
Copy link
Contributor

gunjpan commented Jun 1, 2016

@subchal: I don't have any fix timeline when it will be released, but it will be released soon as it's impacting wider audience. Keep tracking this issue and #2292 as well.

@gunjpan gunjpan added duplicate and removed #verify labels Jun 1, 2016
@gunjpan
Copy link
Contributor

gunjpan commented Jun 1, 2016

@subchal: Closing this issue now as its a duplicate of #2292, please track the progress there. Thank you.

@gunjpan gunjpan closed this as completed Jun 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants