Alex Alex - 3 months ago 24
Javascript Question

Exception in delivering result of invoking 'createUser'

So i'm having trouble invoking the standard Meteor Accounts.createUser function. I'm trying to implement an accounts system using the meteor accounts-base and accounts-password packages. The project is on Meteor 1.3 with React.

When i invoke Accounts.createUser(userObject), i get "Exception in delivering result of invoking 'createUser'" with some cryptic mess behind it.

My code:

onSignUp(e) {
e.preventDefault();

let email = $(e.target).find("[name=email]").val(),
password = $(e.target).find("[name=password]").val(),
confirmPassword = $(e.target).find("[name=confirmPassword]").val();

if (password == confirmPassword) {
Accounts.createUser({
mail: email,
password: password
}, function(error){
if (error) {
Bert.alert( err.reason, 'danger', 'growl-top-right' );
} else {
Bert.alert( "Welcome!", 'success', 'growl-top-right');
console.log(userObject);

FlowRouter.go('/');
}
});


This is currently in my client folder but i tried moving the createAccount call to a server side method but it gives me the same error.

I tried running Meteor in debug mode but i'm having trouble understanding what's happening. From what i could understand while logging in there was either no result or the log in could not be validated.

Any help is much appreciated.

Answer

Replace

Accounts.createUser({
    mail: email,
    password: password
  }

with

Accounts.createUser({
        email: email,      //email
        password: password,
        profile :'default-group',
      }

Also, shift the account creation code to server side.

Refer : Meteor Docs