Cannot Find Accounts.findUserByEmail()

Hello There,

I have encountered a strange problem, that I cannot call Accounts.findUserByEmail(email) in server space.

Meteor Version:
Package: accounts-password
Method: [Accounts.findUserByEmail()][1]
This is a server side function, so I wrap it in a Meteor Call

if (Accounts.findUserByEmail(email)) {
return true;
} else {
return false;

Error Message:

I20151003-16:46:19.021(-7)? Exception while invoking method ‘CheckEmail’ TypeError: Object [object Object] has no method 'findUserByEmail’
I20151003-16:46:19.021(-7)? at [object Object].Meteor.methods.CheckEmail (app/server/methods/AccountManagement.js:5:18)
I20151003-16:46:19.021(-7)? at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1617:1)
I20151003-16:46:19.021(-7)? at packages/ddp/livedata_server.js:648:1
I20151003-16:46:19.021(-7)? at [object Object]..extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20151003-16:46:19.021(-7)? at packages/ddp/livedata_server.js:647:1
I20151003-16:46:19.021(-7)? at [object Object].
.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20151003-16:46:19.021(-7)? at [object Object]._.extend.protocol_handlers.method (packages/ddp/livedata_server.js:646:1)
I20151003-16:46:19.021(-7)? at packages/ddp/livedata_server.js:546:1

I have also printed the content of Accounts, methods like findUserByEmail(email), Accounts.findUserByUsername() does not present as well.
Suggestions are greatly appreciated.

Thank you.

Have you added accounts-password to your app?

1 Like

I have the same problem. The method is invoked from the server.
@robfallows YES! the accounts-password is included

$ meteor add accounts-password
accounts-password without a version constraint has already been added.

Is there any new updates that are not included in docs??
Any help?? Thank you very much.

Ditto. Tried to use the new API, and wasn’t in the expected location.

1 Like

I just created a brand new app (meteor create blah) and added accounts-password. Using meteor shell I can see that Accounts.findUserByEmail is defined correctly. The package.js looks correct. Is it possible some other package is clobbering the Accounts namespace?

I can only think that you could take a list of your current packeges and add them in one-by-one to a new app and see if Accounts.findUserByEmail disappears at some point.

Sorry I can’t be of more help.

Deleted earlier comment. Accounts.findUserByEmail is working on my installation. Earlier comment was related to dumb function construction.