trailsjs / sails-permissions

Comprehensive user permissions and entitlements system for sails.js and Waterline. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.
MIT License
418 stars 113 forks source link

_hookTimeout after changing from a local MngoDB to postgres in AWS RDS #100

Open fuzzball1980 opened 9 years ago

fuzzball1980 commented 9 years ago

Hi, guys, I'm starting doing my first steps with sails and sails-permissions. After following this tutorial http://theambitious.com/index.php/2015/07/26/sailsjs-sails-permissions-on-linux-quick-start/ I changed my adapter to work with a postgres in AWS RDS and I got the following error. I changed the hookTimeout for ORM and the next error was for pubsub, I did the same change and finally I got the same error for sails-permissions hook. I don't know where to change it. I added the files orm.js and pubsub.js

// config/orm.js module.exports.orm = { _hookTimeout: 60000 // I used 60 seconds as my new timeout };

// config/pubsub.js module.exports.pubsub = { _hookTimeout: 60000 // I used 60 seconds as my new timeout };

So I tried to add sails-permissions.js with the content, but it fails to load module.exports.sails-permissions = { _hookTimeout: 60000 // I used 60 seconds as my new timeout };

LOG: info: Starting app...

info: permissions: initializing sails-permissions hook error: Error: The hook orm is taking too long to load. Make sure it is triggering its initialize() callback, or else set `sails.config.orm._hookTimeout to a higher value (currently 20000) at tooLong as _onTimeout at Timer.listOnTimeout as ontimeout

I have already teste a sails project with a simple User api without sails-permissions and it works pretty well with the same AWS RDS instance and deployed in the same server, so I don't think it's something related to the database connection.

Any idea?

Thabk you!

fuzzball1980 commented 9 years ago

More info running --vebose

info: Starting app... verbose: Setting Node environment... verbose: Please run npm install coffee-script to use coffescript (skipping for now) verbose: moduleloader hook loaded successfully. verbose: Loading app config... verbose: userconfig hook loaded successfully. verbose: Exposing global variables... (you can disable this by modifying the properties in sails.config.globals) verbose: Loading user hooks... verbose: userhooks hook loaded successfully. verbose: Loading runtime custom response definitions... verbose: Loading app services... verbose: logger hook loaded successfully. verbose: request hook loaded successfully. verbose: Loading the app's models and adapters... verbose: Loading app models... verbose: Loading app adapters... 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. i18n:debug will write to /opt/testProject/config/locales/en.json +0ms i18n:debug read /opt/testProject/config/locales/en.json for locale: en +1ms i18n:debug will write to /opt/testProject/config/locales/es.json +1ms i18n:debug read /opt/testProject/config/locales/es.json for locale: es +0ms i18n:debug will write to /opt/testProject/config/locales/fr.json +0ms i18n:debug read /opt/testProject/config/locales/fr.json for locale: fr +0ms i18n:debug will write to /opt/testProject/config/locales/de.json +1ms i18n:debug read /opt/testProject/config/locales/de.json for locale: de +0ms 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: http hook loaded successfully. verbose: Overriding ejs engine config with ejslocals to implement layout support... verbose: Preparing socket.io... verbose: sockets hook loaded successfully. verbose: sails-auth hook loaded successfully. info: permissions: initializing sails-permissions hook verbose: Loading adapter ( sails-postgresql ) for criteria from node_modules directory... verbose: views hook loaded successfully. verbose: Setting default Express view engine to ejs... verbose: Starting ORM... verbose: Grunt :: Running "clean:dev" (clean) task verbose: Grunt :: Cleaning .tmp/public... verbose: Grunt :: OK verbose: Grunt :: Running "jst:dev" (jst) task verbose: Grunt :: >> Destination not written because compiled files were empty. verbose: Grunt :: Running "less:dev" (less) task verbose: Grunt :: File .tmp/public/styles/importer.css created: 0 B â 619 B verbose: Grunt :: Running "copy:dev" (copy) task verbose: Grunt :: Copied 3 files verbose: Grunt :: Running "coffee:dev" (coffee) task verbose: Grunt :: Running "sails-linker:devJs" (sails-linker) task verbose: Grunt :: padding length 4 verbose: Grunt :: File "views/layout.ejs" updated. verbose: Grunt :: Running "sails-linker:devStyles" (sails-linker) task verbose: Grunt :: padding length 4 verbose: Grunt :: File "views/layout.ejs" updated. verbose: Grunt :: Running "sails-linker:devTpl" (sails-linker) task verbose: Grunt :: padding length 4 verbose: Grunt :: File "views/layout.ejs" updated. verbose: Grunt :: Running "sails-linker:devJsJade" (sails-linker) task verbose: Grunt :: Running "sails-linker:devStylesJade" (sails-linker) task verbose: Grunt :: Running "sails-linker:devTplJade" (sails-linker) task verbose: Grunt :: Running "watch" task verbose: Grunt :: Waiting... verbose: Lowering sails... verbose: Sent kill signal to child process (24963)... verbose: Shutting down socket server... verbose: Shutting down HTTP server... error: Error: The hook orm is taking too long to load. Make sure it is triggering its initialize() callback, or else set `sails.config.orm._hookTimeout to a higher value (currently 20000) at tooLong as _onTimeout at Timer.listOnTimeout as ontimeout

tjwebb commented 9 years ago
module.exports.sails-permissions = {
_hookTimeout: 60000 // I used 60 seconds as my new timeout
};

This won't do what you want it do. I think you want this:

module.exports['sails-permissions'] = {
_hookTimeout: 60000 // I used 60 seconds as my new timeout
};

I'm surprised you're not seeing this:

Uncaught ReferenceError: Invalid left-hand side in assignment