-
Notifications
You must be signed in to change notification settings - Fork 2
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
Error running bookshelf - Not a aclass #10
Comments
@zuker any thoughts? |
@artmunro the source of an error is here: https://github.com/trailsjs/trails/blob/f54ec3933663b72e32cab26bbe13b1a4e5e97e3a/index.js#L146 'use strict'
const Service = require('trails/service')
/**
* @module UserService
* @description TODO document Service
*/
module.exports = class UserService extends Service {
/**
* Fetches user with profile by id.
* @return Promise
* @example {
* name: 'jdoe',
* proflie: {
* first_name: 'John',
* last_name: 'Doe'
* }
* }
*/
fetchUserWithProfile(id) {
return this.orm.User.forge({ id: id }).fetch({ withRelated: 'profile' });
}
} so if you copypasted service from the example - app will not start. Also please check all of your app models, services, controllers and policies - all of them should export classes. |
I'm getting a similar error and all of my models, services, controllers and policies are exporting classes
|
Trying to get baseline working with Bookshelf after install got error...
trail pack Bookshelf validationError: migrate is not allowed. defaultStore is not allowed
Then added the user, and profile from example .. After npm start get ...
throw new Error(
${resourceName} should be a class. It is a regular object
)^
Error: User should be a class. It is a regular object
at _.mapValues (...S\trails_ems2\node_modules\trails\lib\core.js:60:15)
Package versions ..
"dependencies": {
"express": "^5.0.0-alpha.2",
"trailpack-bookshelf": "^1.0.0-alpha-1",
"trailpack-express": "^2.0.0-rc3",
"trailpack-repl": "v2-latest",
"trailpack-router": "v2-latest",
"trails": "v2-latest",
"winston": "^2.3"
},
XXXXXX node version ...
{
"app": "0.0.0",
"node": "v6.2.1",
"libs": {
"http_parser": "2.7.0",
"node": "6.2.1",
"v8": "5.0.71.52",
"uv": "1.9.1",
"zlib": "1.2.8",
"ares": "1.10.1-DEV",
"icu": "57.1",
"modules": "48",
"openssl": "1.0.2h"
},
"trailpacks": [
{
"name": "repl",
"version": "2.1.0"
},
{
"name": "router",
"version": "2.1.0"
},
{
"name": "express",
"version": "2.0.0-rc3"
}
]
}
The text was updated successfully, but these errors were encountered: