Skip to content

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

@subchal

Description

@subchal

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]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions