SailsJs error with grabConnection(conn) - sails.js

Can someone help me with this SailsJs error
Running "less:dev" (less) task
verbose: Lowering sails...
verbose: Sent kill signal to child process (26729)...
../staging.platform/node_modules/sails-disk/lib/adapter.js:80
grabConnection(conn).dropCollection(coll, relations, cb);
^
TypeError: Cannot read property 'dropCollection' of undefined
at Object.drop (../staging.platform/node_modules/sails-disk/lib/adapter.js:80:27)
at module.exports.drop (../staging.platform/node_modules/waterline/lib/waterline/adapter/ddl/index.js:110:13)
at afterAsyncEach (../staging.platform/node_modules/waterline/lib/waterline/adapter/sync/strategies/alter.js:190:14)
at ../staging.platform/node_modules/async/lib/async.js:52:16
at Object.async.forEachOf.async.eachOf (../staging.platform/node_modules/async/lib/async.js:236:30)
at Object.async.forEach.async.each (../staging.platform/node_modules/async/lib/async.js:209:22)
at ../staging.platform/node_modules/waterline/lib/waterline/adapter/sync/strategies/alter.js:134:13
at wrapper (../staging.platform/node_modules/waterline/node_modules/lodash/index.js:3592:19)
at applyInOriginalCtx (../staging.platform/node_modules/waterline/lib/waterline/utils/normalize.js:421:80)
at wrappedCallback (../staging.platform/node_modules/waterline/lib/waterline/utils/normalize.js:324:18)
at success (../staging.platform/node_modules/waterline/node_modules/switchback/lib/normalize.js:33:31)
at _switch (../staging.platform/node_modules/waterline/node_modules/switchback/lib/factory.js:58:28)
at ../staging.platform/node_modules/sails-disk/lib/adapter.js:88:19
at Timeout._onTimeout (../staging.platform/node_modules/sails-disk/lib/adapter.js:179:10)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
The problem I am having is, this error popped up without real cause. On my local machine my Sails App works - however, on my sandbox remote server, I just started getting the error...
I am completely at a lost...

Related

Updating selectors after delegate addition failed with: Error Domain=NSCocoaError Domain Code=4099

Is anyone able to explain this error, and what might have caused it? I've been trying to create a messaging app using Firebase's Realtime Database in SwiftUI, but am unable to read from the database and have been getting this error.
Updating selectors after delegate addition failed with: Error
Domain=NSCocoaErrorDomain Code=4099 "The connection to service named
com.apple.commcenter.coretelephony.xpc was invalidated: failed at
lookup with error 3 - No such process."
I'm able to write to the database just fine but it doesn't seem to want to be read from, so I'm assuming it's because of whatever this error is. Thanks

A hook (`orm`) failed to load! for Mongodb

Anyone can help??
error: A hook (orm) failed to load!
error: Could not tear down the ORM hook. Error details: Error: Consistency violation: Attempting to tear down a datastore (default) which is not currently registered with this adapter. This is usually due to a race condition in userland code (e.g. attempting to tear down the same ORM instance more than once), or it could be due to a bug in this adapter. (If you get stumped, reach out at http://sailsjs.com/support.)
at Object.teardown (D:\gcloud\test01-2\node_modules\sails-mongo\lib\index.js:390:19)
at D:\gcloud\test01-2\node_modules\waterline\lib\waterline.js:758:27
at D:\gcloud\test01-2\node_modules\async\dist\async.js:3047:20
at eachOfArrayLike (D:\gcloud\test01-2\node_modules\async\dist\async.js:1002:13) at eachOf (D:\gcloud\test01-2\node_modules\async\dist\async.js:1052:9)
at Object.eachLimit (D:\gcloud\test01-2\node_modules\async\dist\async.js:3111:7) at Object.teardown (D:\gcloud\test01-2\node_modules\waterline\lib\waterline.js:742:11)
at Hook.teardown (D:\gcloud\test01-2\node_modules\sails-hook-orm\index.js:246:30)
at Sails.wrapper (D:\gcloud\test01-2\node_modules\#sailshq\lodash\lib\index.js:3275:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at Sails.emit (events.js:208:7)
at Sails.emitter.emit (D:\gcloud\test01-2\node_modules\sails\lib\app\private\after.js:56:26)
at D:\gcloud\test01-2\node_modules\sails\lib\app\lower.js:67:11
at beforeShutdown (D:\gcloud\test01-2\node_modules\sails\lib\app\lower.js:45:12) at Sails.lower (D:\gcloud\test01-2\node_modules\sails\lib\app\lower.js:49:3)
at Sails.wrapper [as lower] (D:\gcloud\test01-2\node_modules\#sailshq\lodash\lib\index.js:3275:19)
at whenSailsIsReady (D:\gcloud\test01-2\node_modules\sails\lib\app\lift.js:68:13)
at D:\gcloud\test01-2\node_modules\sails\node_modules\async\dist\async.js:3861:9 at D:\gcloud\test01-2\node_modules\sails\node_modules\async\dist\async.js:421:16 at iterateeCallback (D:\gcloud\test01-2\node_modules\sails\node_modules\async\dist\async.js:924:17)
at D:\gcloud\test01-2\node_modules\sails\node_modules\async\dist\async.js:906:16error:
error: Error: Consistency violation: Unexpected error creating db connection manager:
```
ImplementationError: Internal error occurred while running createManager. Got non-Error: { MongoError: connection 0 to cluster0-shard-00-00-cqwe8.mongodb.net:27017 closed
at Function.MongoError.create (D:\gcloud\test01-2\node_modules\mongodb-core\lib\error.js:29:11)
at Socket. (D:\gcloud\test01-2\node_modules\mongodb-core\lib\connection\connection.js:202:22)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at TCP._handle.close [as _onclose] (net.js:557:12)
name: 'MongoError',
message: 'connection 0 to cluster0-shard-00-00-cqwe8.mongodb.net:27017 closed' }
If you are the maintainer of "createManager", then you can change its implementation to solve the problem (Most of the time, the solution is just to throw an actual Error instance instead. Alternatively, if the goal was to indicate a particular exception, you could throw any of the special, reserved "exit signals"-- e.g. the code name of any of your defined exits besides "error" or "success"). Otherwise, please file a bug report with the maintainer, or fork your own copy and fix that.
[?] See https://sailsjs.com/support for help.
at Object.registerDatastore (D:\gcloud\test01-2\node_modules\sails-mongo\lib\index.js:263:18)
at D:\gcloud\test01-2\node_modules\waterline\lib\waterline.js:714:27
at D:\gcloud\test01-2\node_modules\async\dist\async.js:3047:20
at eachOfArrayLike (D:\gcloud\test01-2\node_modules\async\dist\async.js:1002:13) at eachOf (D:\gcloud\test01-2\node_modules\async\dist\async.js:1052:9)
at Object.eachLimit (D:\gcloud\test01-2\node_modules\async\dist\async.js:3111:7) at Object.initialize (D:\gcloud\test01-2\node_modules\waterline\lib\waterline.js:650:11)
at buildOntologyAndRunAutoMigrations (D:\gcloud\test01-2\node_modules\sails-hook-orm\lib\build-ontology-and-run-auto-migrations.js:55:7)
at async.auto._buildOntology (D:\gcloud\test01-2\node_modules\sails-hook-orm\lib\initialize.js:456:7)
at runTask (D:\gcloud\test01-2\node_modules\async\dist\async.js:1660:17)
at D:\gcloud\test01-2\node_modules\async\dist\async.js:1602:17
at processQueue (D:\gcloud\test01-2\node_modules\async\dist\async.js:1612:17)
at taskComplete (D:\gcloud\test01-2\node_modules\async\dist\async.js:1630:13)
at D:\gcloud\test01-2\node_modules\async\dist\async.js:1653:21
at D:\gcloud\test01-2\node_modules\async\dist\async.js:339:31
at D:\gcloud\test01-2\node_modules\async\dist\async.js:847:20
at async.auto._checkAdapterCompatibility (D:\gcloud\test01-2\node_modules\sails-hook-orm\lib\initialize.js:428:14)
at runTask (D:\gcloud\test01-2\node_modules\async\dist\async.js:1660:17)
at D:\gcloud\test01-2\node_modules\async\dist\async.js:1602:17
at processQueue (D:\gcloud\test01-2\node_modules\async\dist\async.js:1612:17)
at taskComplete (D:\gcloud\test01-2\node_modules\async\dist\async.js:1630:13)
at D:\gcloud\test01-2\node_modules\async\dist\async.js:1653:21
```
at Object.error (D:\gcloud\test01-2\node_modules\sails-mongo\lib\index.js:268:21)
at D:\gcloud\test01-2\node_modules\machine\lib\private\help-build-machine.js:1514:39
at proceedToFinalAfterExecLC (D:\gcloud\test01-2\node_modules\parley\lib\private\Deferred.js:1149:14)
at proceedToInterceptsAndChecks (D:\gcloud\test01-2\node_modules\parley\lib\private\Deferred.js:909:12)
at proceedToAfterExecSpinlocks (D:\gcloud\test01-2\node_modules\parley\lib\private\Deferred.js:841:10)
at D:\gcloud\test01-2\node_modules\parley\lib\private\Deferred.js:303:7
at D:\gcloud\test01-2\node_modules\machine\lib\private\help-build-machine.js:952:35
at Function.handlerCbs.error (D:\gcloud\test01-2\node_modules\machine\lib\private\help-build-machine.js:742:26)
at connectCb (D:\gcloud\test01-2\node_modules\sails-mongo\lib\private\machines\create-manager.js:130:22)
at connectCallback (D:\gcloud\test01-2\node_modules\mongodb\lib\mongo_client.js:428:5)
at D:\gcloud\test01-2\node_modules\mongodb\lib\mongo_client.js:335:11
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
You should set config.datastore.default.adapter: 'sails-mongo'. Moreover, if you modified a model while there was data in the db you should drop it.

Sails.js unit testing getting uncaught error

Being working with sails.js and i was writing test cases using MOCHA and grunt am getting Uncaught error. I searched over net but i didn't get clear solution. how to get started with sails.js unit testing?
1) "before all" hook:
Uncaught Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Server._listen2 (net.js:1156:14)
at listen (net.js:1182:10)
at Server.listen (net.js:1267:5)
at Object.module.exports.bootstrap (config/bootstrap.js:16:3)
this above error am getting while running 'grunt test', thanks.
Update:
Actually there are two servers running so that created this issue. just kill one server it works fine.

Sails.js + MongoDB when lifting often throw error "`orm` is taking too long to load"

Why the error
`Error: The hook 'orm' is taking too long to load.`
It occurs very often when sails is lifting? Even orm timeout already set to 100000, it still occur sometimes (not always). Usually it happen after PC has been restarted and sails run at first time.
It also often occur at cloud server and my laptop beside my PC. So it occur at 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 error report is 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 it a MongoDB adapter bug?
I have encountered the same error recently and found syntax error in one of my model. Now it is working fine. SO basically this error occurs because of some error related to the database. you can check your models, connection, etc..

Meteor accounts not working

Basic problem: logging into Meteor app isn't working and I don't know why.
I have a meteor app that uses the accounts-password package, but whenever I try to log in (whether it be with the accounts-ui dropdown or by calling Meteor.loginWithPassword), there is an "internal server error", as it shows on the accounts-ui dropdown.
I had the app working (I just was always logged in already), but I ran the meteor reset command to clear out the databases, and now it doesn't allow logging in. I even tried Meteor.loginWithToken, using the token I found in the mongo console for a user, but even that didn't work (still internal server error).
On the server, it shows a bunch of "MongoError" Exceptions, which are periodically emitted after trying to log in the first time. I tried using accounts-google instead, but same error occurs. This also happens when creating accounts, as it logs you in afterward (but it does create the account before crashing). Meanwhile, the client console shows no errors (just the "internal server error" in the page itself).
Here are the first error messages that show up on the server when logging in:
I20130821-10:55:59.266(-4)? Exception from task: MongoError: invalid query
I20130821-10:55:59.335(-4)? at Object.Future.wait (/Users/efriis/.meteor/tools/4010e5731d/lib/node_modules/fibers/future.js:326:15)
I20130821-10:55:59.336(-4)? at _.extend._nextObject (packages/mongo-livedata/mongo_driver.js:540)
I20130821-10:55:59.336(-4)? at _.extend.forEach (packages/mongo-livedata/mongo_driver.js:570)
I20130821-10:55:59.336(-4)? at _.extend.getRawObjects (packages/mongo-livedata/mongo_driver.js:621)
I20130821-10:55:59.336(-4)? at _.extend._pollMongo (packages/mongo-livedata/mongo_driver.js:897)
I20130821-10:55:59.336(-4)? at _.extend._addFirstObserveHandle (packages/mongo-livedata/mongo_driver.js:830)
I20130821-10:55:59.338(-4)? at Meteor.bindEnvironment.runWithEnvironment (packages/meteor/dynamics_nodejs.js:69)
I20130821-10:55:59.338(-4)? at Object.Meteor.bindEnvironment [as task] (packages/meteor/dynamics_nodejs.js:79)
I20130821-10:55:59.338(-4)? at _.extend._run (packages/meteor/fiber_helpers.js:144)
I20130821-10:55:59.338(-4)? at _.extend._scheduleRun (packages/meteor/fiber_helpers.js:122)
I20130821-10:55:59.338(-4)? - - - - -
I20130821-10:55:59.338(-4)? at Object.toError (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/utils.js:110:11)
I20130821-10:55:59.338(-4)? at Cursor.nextObject.self.queryRun (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:634:54)
I20130821-10:55:59.339(-4)? at Cursor.close (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:903:5)
I20130821-10:55:59.339(-4)? at Cursor.nextObject.commandHandler (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:634:21)
I20130821-10:55:59.340(-4)? at Db._executeQueryCommand (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/db.js:1658:9)
I20130821-10:55:59.340(-4)? at Server.Base._callHandler (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/base.js:378:41)
I20130821-10:55:59.340(-4)? at Server.connect.connectionPool.on.server._serverState (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/server.js:468:18)
I20130821-10:55:59.340(-4)? at MongoReply.parseBody (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
I20130821-10:55:59.340(-4)? at Server.connect.connectionPool.on.server._serverState (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/server.js:426:20)
I20130821-10:55:59.340(-4)? at EventEmitter.emit (events.js:96:17)
I20130821-10:55:59.341(-4)? Exception while invoking method 'login' MongoError: invalid query
I20130821-10:55:59.341(-4)? at Object.Future.wait (/Users/efriis/.meteor/tools/4010e5731d/lib/node_modules/fibers/future.js:326:15)
I20130821-10:55:59.341(-4)? at _.extend.runTask (packages/meteor/fiber_helpers.js:79)
I20130821-10:55:59.341(-4)? at _.extend._addFirstObserveHandle (packages/mongo-livedata/mongo_driver.js:829)
I20130821-10:55:59.342(-4)? at MongoConnection._observeChanges (packages/mongo-livedata/mongo_driver.js:688)
I20130821-10:55:59.342(-4)? at Cursor.observeChanges (packages/mongo-livedata/mongo_driver.js:480)
I20130821-10:55:59.342(-4)? at Function.Meteor.Collection._publishCursor (packages/mongo-livedata/collection.js:232)
I20130821-10:55:59.343(-4)? at Cursor._publishCursor (packages/mongo-livedata/mongo_driver.js:461)
I20130821-10:55:59.343(-4)? at _.extend._runHandler (packages/livedata/livedata_server.js:868)
I20130821-10:55:59.343(-4)? at _.extend._setUserId.self._dontStartNewUniversalSubs (packages/livedata/livedata_server.js:696)
I20130821-10:55:59.343(-4)? at Function._.each._.forEach (packages/underscore/underscore.js:87)
I20130821-10:55:59.343(-4)? - - - - -
I20130821-10:55:59.343(-4)? at Object.Future.wait (/Users/efriis/.meteor/tools/4010e5731d/lib/node_modules/fibers/future.js:326:15)
I20130821-10:55:59.344(-4)? at _.extend._nextObject (packages/mongo-livedata/mongo_driver.js:540)
I20130821-10:55:59.344(-4)? at _.extend.forEach (packages/mongo-livedata/mongo_driver.js:570)
I20130821-10:55:59.344(-4)? at _.extend.getRawObjects (packages/mongo-livedata/mongo_driver.js:621)
I20130821-10:55:59.345(-4)? at _.extend._pollMongo (packages/mongo-livedata/mongo_driver.js:897)
I20130821-10:55:59.345(-4)? at _.extend._addFirstObserveHandle (packages/mongo-livedata/mongo_driver.js:830)
I20130821-10:55:59.345(-4)? at Meteor.bindEnvironment.runWithEnvironment (packages/meteor/dynamics_nodejs.js:69)
I20130821-10:55:59.345(-4)? at Object.Meteor.bindEnvironment [as task] (packages/meteor/dynamics_nodejs.js:79)
I20130821-10:55:59.345(-4)? at _.extend._run (packages/meteor/fiber_helpers.js:144)
I20130821-10:55:59.346(-4)? at _.extend._scheduleRun (packages/meteor/fiber_helpers.js:122)
I20130821-10:55:59.346(-4)? - - - - -
I20130821-10:55:59.346(-4)? at Object.toError (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/utils.js:110:11)
I20130821-10:55:59.346(-4)? at Cursor.nextObject.self.queryRun (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:634:54)
I20130821-10:55:59.346(-4)? at Cursor.close (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:903:5)
I20130821-10:55:59.346(-4)? at Cursor.nextObject.commandHandler (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:634:21)
I20130821-10:55:59.347(-4)? at Db._executeQueryCommand (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/db.js:1658:9)
I20130821-10:55:59.347(-4)? at Server.Base._callHandler (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/base.js:378:41)
I20130821-10:55:59.347(-4)? at Server.connect.connectionPool.on.server._serverState (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/server.js:468:18)
I20130821-10:55:59.347(-4)? at MongoReply.parseBody (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
I20130821-10:55:59.347(-4)? at Server.connect.connectionPool.on.server._serverState (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/server.js:426:20)
I20130821-10:55:59.348(-4)? at EventEmitter.emit (events.js:96:17)
I'm stumped. Any Ideas?
Simple problem, just didn't show up in the error console:
I was publishing a collection from server, and I used the $in operator incorrectly. I had two arrays in it, rather than just using the concat() method to join them. This solved the problem.
To find out which query caused such an error, you can put console.log(this.query) into any place of the QueryCommand.prototype.toBinary function in ~/.meteor/packages/mongo-livedata/0120179b5c/npm/node_modules/mongodb/lib/mongodb/commands/query_command.js. The number part of the path (0120179b5c) can be looked up in the original error message.
In the new console output, the query will appear right before the error message.
Happy debugging!