1

I've written a custom accounts package that validates a user's email and password through our internal system. When running locally on my or anyone else's computer, this works fine; users are able to log in and use our meteor app. Recently I've deployed the app to Modulus.io. Deployment goes smoothly without any errors, and I can load the homepage of the site and perform actions that don't require being logged in. When I try to log in, however, the client says that I entered the wrong username/password combo, and the server throws this exception:

Exception while invoking method 'login' Error: setUserId must be called on string or null, not object
    at [object Object]._.extend._setUserId (packages/ddp/livedata_server.js:701:1)
    at [object Object].setUserId [as _setUserId] (packages/ddp/livedata_server.js:634:1)
    at [object Object]._.extend.setUserId (packages/ddp/livedata_common.js:100:1)
    at loginUser (packages/accounts-base/accounts_server.js:206:1)
    at attemptLogin (packages/accounts-base/accounts_server.js:255:1)
    at [object Object].Meteor.methods.login (packages/accounts-base/accounts_server.js:411:1)
    at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1617:1)
    at packages/ddp/livedata_server.js:648:1
    at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
    at packages/ddp/livedata_server.js:647:1

As you can see, the stack trace of the exception never touches any files except those in the accounts_base and ddp packages, both of which are developed by the Meteor Development Group. This, accompanied with the fact that everything works properly on my local machine, leads me to believe that the error comes from how modulus.io is configured, rather than my own code.

My problem seems related to this Meteor GitHub issue, where someone was getting the same error as I was. The difference was that they were dealing with a database that already had users in it. The modulus.io MongoDB database that I set up is completely empty, save for some entries used by the roles meteor package. Looking through my accounts package, I'm never manually adding objects as user IDs, which would also cause the project to not work on my local machine, either.

Any help would be greatly appreciated. Thanks in advance!

davish
  • 219
  • 3
  • 11
  • 1
    I haven't tried Modulus, but you should probably check your `users` collection and see what the user `_id`s look like. MongoDB uses `ObjectId`s by default, and perhaps there's something that's forcing the ids that are created by `useraccounts` to be transformed into `ObjectIds`. That would be a good place to start. – MasterAM Oct 25 '15 at 10:03

0 Answers0