Sails version: 0.12.2
Node version: 5.10.0
NPM version: 3.8.5
Operating system: GNU/Linux 4.4.5-1-ARCH
$ sails lift
info: Starting app...
debug: hookPath: /home/scippio/projects/up-time/web/node_modules/sails-auth/dist/api/hooks/auth
debug: marlinspike (auth): loading config from /home/scippio/projects/up-time/web/node_modules/sails-auth/dist/config
debug: hookPath: /home/scippio/projects/up-time/web/node_modules/sails-permissions/dist/api/hooks/permissions
debug: marlinspike (permissions): loading config from /home/scippio/projects/up-time/web/node_modules/sails-permissions/dist/config
debug: marlinspike (auth): loading Services from /home/scippio/projects/up-time/web/node_modules/sails-auth/dist/api/services...
debug: marlinspike (auth): loading Models...
debug: marlinspike (auth): loading Controllers...
debug: marlinspike (auth): loading Policies...
warn: sails.getBaseUrl() is deprecated and will be removed in Sails v1.0. See http://sailsjs.org/documentation/reference/application/sails-getbaseurl for more info.
debug: marlinspike (permissions): loading Services from /home/scippio/projects/up-time/web/node_modules/sails-permissions/dist/api/services...
debug: marlinspike (permissions): loading Models...
debug: marlinspike (permissions): loading Controllers...
debug: marlinspike (permissions): loading Policies...
error: A hook (`orm`) failed to load!
error: Error: on mapping custom foreign keys: role->user. Attribute: `roles` does not exist on: collection: `user`
at JoinTables.parseAttribute (/usr/lib/node_modules/sails/node_modules/waterline-schema/lib/waterline-schema/joinTables.js:150:11)
at /usr/lib/node_modules/sails/node_modules/waterline-schema/lib/waterline-schema/joinTables.js:83:22
at Array.forEach (native)
at JoinTables.buildJoins (/usr/lib/node_modules/sails/node_modules/waterline-schema/lib/waterline-schema/joinTables.js:82:24)
at new JoinTables (/usr/lib/node_modules/sails/node_modules/waterline-schema/lib/waterline-schema/joinTables.js:40:23)
at new module.exports (/usr/lib/node_modules/sails/node_modules/waterline-schema/lib/waterline-schema.js:33:17)
at [object Object].Waterline.initialize (/usr/lib/node_modules/sails/node_modules/waterline/lib/waterline.js:104:17)
at buildWaterlineOntology (/usr/lib/node_modules/sails/node_modules/sails-hook-orm/lib/build-waterline-ontology.js:45:19)
at Array.async.auto._buildOntology (/usr/lib/node_modules/sails/node_modules/sails-hook-orm/lib/initialize.js:388:7)
at listener (/usr/lib/node_modules/sails/node_modules/sails-hook-orm/node_modules/async/lib/async.js:605:42)
at /usr/lib/node_modules/sails/node_modules/sails-hook-orm/node_modules/async/lib/async.js:544:17
at _arrayEach (/usr/lib/node_modules/sails/node_modules/sails-hook-orm/node_modules/async/lib/async.js:85:13)
at Immediate.taskComplete (/usr/lib/node_modules/sails/node_modules/sails-hook-orm/node_modules/async/lib/async.js:543:13)
at tryOnImmediate (timers.js:534:15)
at processImmediate [as _immediateCallback] (timers.js:514:5)
Hi @scippio! It looks like you may have removed some required elements from the initial comment template, without which I can't verify that this post meets our contribution guidelines. To re-open this issue, please copy the template from here, paste it at the beginning of your initial comment, and follow the instructions in the text. Then post a new comment (e.g. "ok, fixed!") so that I know to go back and check.
Sorry to be a hassle, but following these instructions ensures that we can help you in the best way possible and keep the Sails project running smoothly.
_If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]._
fixed... (making bot happy)
Sorry to be a hassle, but it looks like your issue is still missing some required info. Please double-check your initial comment and try again.
_If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]._
And... now? :D
Sorry to be a hassle, but it looks like your issue is still missing some required info. Please double-check your initial comment and try again.
_If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]._
And now? :(
+1 Same issue, after rolling back to 0.12.1 the issue disappeared
@scippio Thanks for the report. And @bountyx, thanks for verifying on 0.12.1.
From your error stack, it looks like you're using a 3rd party module I'm not familiar with. That module is not using any documented plugin system of Sails, so while I'm sorry for the inconvenience, I can't spend very much time looking into it since I haven't been able to replicate any similar problems using Sails by itself.
However, I did spend an hour looking into it this morning, which revealed that this plugin monkey patches models without waiting for the ORM hook to load. This appears to have worked prior to the extrapolation of the ORM hook, but it was never the intended behavior-- the plugin should wait to register models until after the ORM hook has loaded using sails.after() (example of that here).
The extrapolation of the ORM hook, and a lot of the other work we've been doing around internal documentation, is motivated by an interest in providing documented, reliable interfaces for developers building plugins on top of Sails core. The core events and hooks interface has been a part of Sails core since v0.9, and became officially available for use with plugins in 2015. We recently pulled out all of the relevant internal documentation into a documentation page on sailsjs.org. If you are interested in a core mechanism for programmatically attaching models and/or controllers to Sails apps, I'm happy to help as much as I can (please make a proposal PR and link to it from here).
Thanks for the quick response. I'm not using marlinspike and still get a similar ORM error after upgrading from 0.12.1 to 0.12.2 (downgrading also reverts the issue). Here's my stack dump --do you think this is a different issue, or still related to a third-party module?
> sails lift ~/Work/apozy/Source/affogato/app(master✗)@lappy.local
info: Starting app...
verbose: logger hook loaded successfully.
verbose: request hook loaded successfully.
verbose: Loading the app's models and any custom adapters...
verbose: Loading app models...
verbose: Loading app adapters...
verbose: views hook loaded successfully.
verbose: Loading blueprint middleware...
verbose: blueprints hook loaded successfully.
verbose: responses hook loaded successfully.
verbose: controllers hook loaded successfully.
verbose: Loading policy modules from app...
verbose: Finished loading policy middleware logic.
verbose: policies hook loaded successfully.
verbose: services hook loaded successfully.
verbose: csrf hook loaded successfully.
verbose: cors hook loaded successfully.
verbose: i18n hook loaded successfully.
verbose: session hook loaded successfully.
verbose: Loading app Gruntfile...
verbose: Tracking new grunt child process...
verbose: grunt hook loaded successfully.
verbose: Setting default Express view engine to ejs...
verbose: http hook loaded successfully.
verbose: Preparing socket.io...
verbose: sockets hook loaded successfully.
verbose: Autoreload watching: [ 'app/api/controllers',
'app/api/models',
'app/api/services',
'app/config/locales' ]
verbose: autoreload hook loaded successfully.
verbose: Loading adapter (`sails-mongo`) from this app's `node_modules/` directory...
verbose: Starting ORM...
error: A hook (`orm`) failed to load!
verbose: Lowering sails...
verbose: Sent kill signal to child process (68641)...
verbose: Shutting down HTTP server...
verbose: HTTP server shut down successfully.
error: TypeError: Cannot convert undefined or null to object
at hasOwnProperty (native)
at exports.object.hasOwnProperty (app/node_modules/waterline-schema/lib/waterline-schema/utils.js:48:14)
at Attributes.autoAttributes (app/node_modules/waterline-schema/lib/waterline-schema/attributes.js:182:8)
at Attributes.normalize (app/node_modules/waterline-schema/lib/waterline-schema/attributes.js:72:8)
at app/node_modules/waterline-schema/lib/waterline-schema/attributes.js:37:23
at Array.forEach (native)
at new Attributes (app/node_modules/waterline-schema/lib/waterline-schema/attributes.js:36:15)
at new module.exports (app/node_modules/waterline-schema/lib/waterline-schema.js:27:17)
at Waterline.initialize (app/node_modules/sails-hook-orm/node_modules/waterline/lib/waterline.js:104:17)
at buildWaterlineOntology (app/node_modules/sails-hook-orm/lib/build-waterline-ontology.js:45:19)
at Array.async.auto._buildOntology (app/node_modules/sails-hook-orm/lib/initialize.js:388:7)
at listener (app/node_modules/sails-hook-orm/node_modules/async/lib/async.js:605:42)
at app/node_modules/sails-hook-orm/node_modules/async/lib/async.js:544:17
at _arrayEach (app/node_modules/sails-hook-orm/node_modules/async/lib/async.js:85:13)
at Immediate.taskComplete (app/node_modules/sails-hook-orm/node_modules/async/lib/async.js:543:13)
at processImmediate [as _immediateCallback] (timers.js:383:17)
P.S. I tried removing sails-hook-autoreload, no change in the behavior.
I don't know what module it is... I just have these dependencies only:
"dependencies": {
"coffee-script ": "^1.10.0",
"ejs": "2.3.4",
"grunt": "0.4.5",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-coffee": "0.13.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-cssmin": "0.9.0",
"grunt-contrib-jst": "0.6.0",
"grunt-contrib-less": "1.1.0",
"grunt-contrib-sass": "^0.9.2",
"grunt-contrib-uglify": "0.7.0",
"grunt-contrib-watch": "0.5.3",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.2.4",
"include-all": "~0.1.6",
"rc": "1.0.1",
"sails": "0.12.2",
"sails-auth": "^2.1.3",
"sails-disk": "~0.10.9",
"sails-mysql": "^0.11.5",
"sails-permissions": "^2.2.0"
},
@scippio sails-auth pulls in marlinspike dependency which is doing the monkey patching @mikermcneil mentioned. It appears that sails-auth is no longer maintained and therefore not compatible with newer versions of sails.
@scippio,@sailsbot,@bountyx,@mikermcneil: Hello, I'm a repo bot-- nice to meet you!
It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message and simply close the issue if possible. On the other hand, if you are still waiting on a patch, please post a comment to keep the thread alive (with any new information you can provide).
If no further activity occurs on this thread within the next 3 days, the issue will automatically be closed.
Thanks so much for your help!
Most helpful comment
@scippio sails-auth pulls in marlinspike dependency which is doing the monkey patching @mikermcneil mentioned. It appears that sails-auth is no longer maintained and therefore not compatible with newer versions of sails.