I’m invoking the
Accounts.createUserVerifyingEmail(newUser) function from a server method. It works perfectly (the message gets sent and all), but in the browser console, I get this error:
AccountsCollection.js:60 Uncaught (in promise) TypeError: Accounts.createUserVerifyingEmail is not a function
The offending line:
Note: the Accounts collection is in fact a company collection, to which users belong. It has nothing to do with Meteor accounts-base or accounts-password packages.
Why is this? How can I avoid it?
Thanks in advance.
AccountsCollection doesn’t have anything to do with the accounts-base, or accounts-password packages, the
Accounts variable and it’s method
createUserVerifyingEmail absolutely does and it appears that it is being called from the file
AccountsCollection.js on line 60 on the client. Being that
Accounts.createUserVerifyingEmail is a server only method this is causing your issue.
Meteor.methods call runs on the client it sets up client stubs for those methods so that they can simulate server actions and provide latency compensation and optimistic updates. In this case since you have code that can not run on the client I think the best course of action is to ensure that the code that defines the method you are calling is never run on the client and thus does not create the method stub.