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.