1

My sails application not able to connect to locally running mongo db instance local.js is like below

module.exports.connections = {

  sailsMongoDBServer: {
        adapter: 'sails-mongo',
        host: '127.0.0.1',
        port: 27017,
        database: 'dp-manager-db'
      }
}

Error :

2019-03-06T12:32:01.081Z - error:
{ message:
   'The hook `orm` is taking too long to load.\nMake sure it is triggering its `initialize()` callback, or else set `sails.config.orm._hookTimeout to a higher value (currently 20000)',
  stack:
   'Error: The hook `orm` is taking too long to load.\nMake sure it is triggering its `initialize()` callback, or else set `sails.config.orm._hookTimeout to a higher value (currently 20000)\n    at Timeout.tooLong [as _onTimeout] (E:\\workspace_DpForm\\Eclipse\\dpm-app\\node_modules\\sails\\lib\\app\\private\\loadHooks.js:85:21)\n    at ontimeout (timers.js:436:11)\n    at tryOnTimeout (timers.js:300:5)\n    at listOnTimeout (timers.js:263:5)\n    at Timer.processTimers (timers.js:223:10)',
  code: 'E_HOOK_TIMEOUT' }
2019-03-06T12:32:03.521Z - error: A hook (`orm`) failed to load!
E:\workspace_DpForm\Eclipse\dpm-app\node_modules\mongodb\lib\mongo_client.js:224
          throw err
Raj N
  • 249
  • 1
  • 18
  • Do you have your mongoDB set up on your `config/datastores.js`? – Raqem Mar 06 '19 at 15:31
  • These docs might also help: https://sailsjs.com/documentation/reference/configuration/sails-config-datastores#?using-a-local-mysql-database-in-development – Raqem Mar 06 '19 at 15:32
  • Did you run `mongod`? Before I do `sails lift` I have to do `& 'C:\Program Files\MongoDB\Server\4.0\bin\mongod'` to start running mongo in the background terminal. – Noitidart Mar 12 '19 at 03:15
  • @Noitidart Yes, i have started mongod also i could able to run and connect mongo client and compass , still sails application not able to connect – Raj N Mar 12 '19 at 07:41
  • Let me ask you a few questions to be able to help you: 1) which sails version are you using 2) can you create a sample project in github and share it? – Luis Lobo Borobia Mar 14 '19 at 15:18
  • What version of `sails-mongo` are you using? I have seen this happen with `~0.10.x` and node v6. Try upgrading to the latest version of `sails-mongo` and increase hook if needed as answered here: https://stackoverflow.com/questions/28524926/the-hook-orm-taking-too-long-to-load – Shubhankar S Apr 04 '19 at 04:26
  • @ShubhankarS i am using "sails-mongo": "0.12.3", – Raj N Apr 04 '19 at 05:45

0 Answers0