Sails.js + MongoDB when booting up often throws an error "orm takes too long to load"

Why error

`Error: The hook 'orm' is taking too long to load.` 

      

Does this happen very often when the sails are hoisted? Even orm timeout

already set to 100,000, it still occurs occasionally ( not always ). This usually happens after restarting the PC and the sails are launched for the first time.

It's also common on the cloud server and my laptop next to my PC. This is what happens in my tested environment:

  • Windows 8.1 (PC and laptop) and Linux (Ubuntu 14.04)
  • node.js version 0.10.38
  • sails version 0.11
  • MongoDB version 3

The complete bug report looks like this

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 [object Object].tooLong [as _onTimeout] (D:\Workspace\Hellowin\cannes\node_modules\sails\lib\app\private\loadHooks.js:92:21)
  at Timer.listOnTimeout [as ontimeout] (timers.js:112:15) { [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)] code: 'E_HOOK_TIMEOUT' }

D:\Workspace\Hellowin\cannes\node_modules\sails\node_modules\async\lib\async.js:30
        if (called) throw new Error("Callback was already called.");
                          ^
Error: Callback was already called.
  at D:\Workspace\Hellowin\cannes\node_modules\sails\node_modules\async\lib\async.js:30:31
  at process._tickDomainCallback (node.js:492:13)

      

Is this a MongoDB adapter bug?

+3


source to share


1 answer


I recently ran into the same error and encountered a syntax error in one of my models. It works fine now. SO basically this error comes from some kind of error related to the database. you can check your models, connection, etc.



0


source







All Articles