Meteor 1.2 (HELP TO TEST)
We updated the project to the, just released, Meteor 1.2.
The updated code is in this branch https://github.com/RocketChat/Rocket.Chat/tree/meteor-1.2 and we need help to test if is everything working.
:ok_hand:
When creating a new account I am seeing in the console:
$ git status
On branch meteor-1.2
Your branch is up-to-date with 'origin/meteor-1.2'.
nothing to commit, working directory clean
I20150927-09:52:09.883(-4)? Exception while invoking method 'registerUser' TypeError: Cannot call method 'insert' of undefined
I20150927-09:52:09.884(-4)? at Ap.insertUserDoc (accounts_server.js:1248:25)
I20150927-09:52:09.884(-4)? at AccountsServer.<anonymous> (server/lib/accounts.coffee:51:8)
I20150927-09:52:09.884(-4)? at AccountsServer.insertUserDoc (packages/underscore/underscore.js:763:1)
I20150927-09:52:09.884(-4)? at createUser (packages/accounts-password/password_server.js:980:1)
I20150927-09:52:09.884(-4)? at AccountsServer.Accounts.createUser (packages/accounts-password/password_server.js:1049:1)
I20150927-09:52:09.884(-4)? at [object Object].Meteor.methods.registerUser (server/methods/registerUser.coffee:7:21)
I20150927-09:52:09.885(-4)? at [object Object].methodMap.(anonymous function) (packages/meteorhacks_kadira/packages/meteorhacks_kadira.js:2554:1)
I20150927-09:52:09.885(-4)? at maybeAuditArgumentChecks (livedata_server.js:1692:12)
I20150927-09:52:09.885(-4)? at livedata_server.js:708:19
I20150927-09:52:09.885(-4)? at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
^C
It fails on Account_servers.js part of Accounts-base in:
Ap.insertUserDoc = function (options, user) {
when running this line:
userId = this.users.insert(fullUser);
Because this.users is undefined.
Accounts-Base used Meteor.users.insert in 1.2.0 but 1.2.1 uses this.users. Meteor.users still returns an object but this.users is undefined.
Any reason why this.users on serverside would return as undefined in this case?
Ap object is created on accounts_common.js from a call to AccountsCommon.prototype which, AFAICT, does not call AccountsCommon constructor method -- created this snippet for testing.
EDIT: changed snippet to GIST which can be executed here.
I would say this is an accounts-base bug. Thoughts?
@gmsecrieru what makes you think meteor's code is trying to do this exactly? I don't think they are trying to access an instance variable through it's prototype.
I think this is what we should expect to happen: https://gist.github.com/marceloschmidt/6d8cd7b38d1d9fb986f9
It doesn't explain why meteor's code isn't working though :(
@marceloschmidt The Ap object, which is created on accounts_common.js from AccountCommon`s prototype has a method called insertUserDoc, which is declared on accounts_server.js and called by account-password.
The call to what-should-be users collection object is done from within Ap as this.users. The problem here is that this.users is set within AccountCommon constructor, thus Ap.users === undefined until we call the constructor method.
Also, this is definitely something we did, because removing this piece of code makes it work again:
https://github.com/RocketChat/Rocket.Chat/blob/master/server%2Flib%2Faccounts.coffee#L48-L59
I think you can close that issue you opened at Meteor and I'll focus on fixing this on our side.
Yes, but if you look at packages/accounts-base/globals_server.js you'll see that Accounts is set to new AccountsServer, which runs the constructor for later on calling Accounts.insertUserDoc
But the triggered exception is coming from Ap, not AccountsServer:
I20150927-09:52:09.883(-4)? Exception while invoking method 'registerUser' TypeError: Cannot call method 'insert' of undefined I20150927-09:52:09.884(-4)? at Ap.insertUserDoc (accounts_server.js:1248:25)
We just fixed that in https://github.com/RocketChat/Rocket.Chat/commit/b523eb9d18c223166b923579533be764d2d4b6ae
:+1: working on 1.2.0.2
Closing as Meteor 1.2 was already merged into master
Please help while calling this method process get stuck. _id = insertUserDoc.call(Accounts, options, user)
input: { username: 'Guest_3129810000-14:35', department: 'mt3uAwpz4dSqow7pg', type: 'visitor', custid: 0, country: undefined, userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36', ip: '127.0.0.1', host: 'localhost:3000' }