Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meteor 1.2 (HELP TO TEST) #852

Closed
rodrigok opened this issue Sep 22, 2015 · 12 comments
Closed

Meteor 1.2 (HELP TO TEST) #852

rodrigok opened this issue Sep 22, 2015 · 12 comments

Comments

@rodrigok
Copy link
Member

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.

@sampaiodiego
Copy link
Member

👌

@garg
Copy link

garg commented Sep 27, 2015

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?

@gmsecrieru
Copy link
Contributor

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?

@marceloschmidt
Copy link
Member

@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 :(

@gmsecrieru
Copy link
Contributor

@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.

@marceloschmidt
Copy link
Member

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.

@marceloschmidt marceloschmidt self-assigned this Sep 29, 2015
@marceloschmidt
Copy link
Member

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

@gmsecrieru
Copy link
Contributor

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)

@marceloschmidt
Copy link
Member

We just fixed that in b523eb9

@gmsecrieru
Copy link
Contributor

👍 working on 1.2.0.2

@gmsecrieru
Copy link
Contributor

Closing as Meteor 1.2 was already merged into master

@vikas0121
Copy link

vikas0121 commented Jul 25, 2018

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' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants