Hi all,
I'm new to StrongLoop & trying to create an application, for same I'm creating Datasource & after entering all details I'm getting following Exception
Oops! Something is wrong
User is referencing a dataSource that does not exist: "db"
Name: AssertionError
Message: User is referencing a dataSource that does not exist: "db"
Request: /workspace/api/DataSourceDefinitions/server.DS1/testConnection
status: 500
Thanks in advance
Did you install the connector?
npm install --save loopback-connector-mysql
I am assuming you're using MySql based on your screenshot. Install the corresponding datasource connector that you need.
https://docs.strongloop.com/display/APIS/Creating+and+editing+data+sources
Same here with postgreSQL connector.. I fill the name of connection and all working data, the file \server\datasources.json is filled with follwing data(which are correct):
{
"hb_automation_framework": {
"host": "192.168.99.100",
"port": 5432,
"database": "postgres",
"password": "zangetsu",
"name": "hb_automation_framework",
"user": "zangetsu",
"connector": "postgresql"
}
}
I will search for string "db" if it is refered somewhere in project...
Ok, I found the root cause, there is file: /server/model-config.json, the project has been created by scl command probably and here is the content:
{
"_meta": {
"sources": [
"loopback/common/models",
"loopback/server/models",
"../common/models",
"./models"
],
"mixins": [
"loopback/common/mixins",
"loopback/server/mixins",
"../common/mixins",
"./mixins"
]
},
"User": {
"dataSource": "db"
},
"AccessToken": {
"dataSource": "db",
"public": false
},
"ACL": {
"dataSource": "db",
"public": false
},
"RoleMapping": {
"dataSource": "db",
"public": false
},
"Role": {
"dataSource": "db",
"public": false
}
}
I changed all dataSource entries to reflect my datasource name a then testing datasource in ARC finished with success.
hi @archenroot @0candy same in here. here is my setup
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
I also got the error from loading datasources
I have set NODE_ENV=production
I have setup mode-config.production.json with the correct configurations but it still failed.
The datasource file is here
Unhandled rejection AssertionError: AccessToken is referencing a dataSource that does not exist: "rocket_us_east"
Most helpful comment
Ok, I found the root cause, there is file: /server/model-config.json, the project has been created by scl command probably and here is the content:
{ "_meta": { "sources": [ "loopback/common/models", "loopback/server/models", "../common/models", "./models" ], "mixins": [ "loopback/common/mixins", "loopback/server/mixins", "../common/mixins", "./mixins" ] }, "User": { "dataSource": "db" }, "AccessToken": { "dataSource": "db", "public": false }, "ACL": { "dataSource": "db", "public": false }, "RoleMapping": { "dataSource": "db", "public": false }, "Role": { "dataSource": "db", "public": false } }I changed all dataSource entries to reflect my datasource name a then testing datasource in ARC finished with success.