Accounts.onCreateUser Not Working Yet in Mv3 rc-0.4? [SOLVED]

Here is sample code from the Mv3 docs for Accounts.onCreateUser :

Accounts.onCreateUser((options, user) => {
  const customizedUser = Object.assign(
    {
      dexterity: _.random(1, 6) + _.random(1, 6) + _.random(1, 6),
    },
    user
  );

  // We still want the default hook's 'profile' behavior.
  if (options.profile) {
    customizedUser.profile = options.profile;
  }

  return customizedUser;
});

Running it as-is throws an error:

Exception while invoking method ‘createUser’ TypeError: Promise.await is not a function

I see what it was. I had a Promise.await call in my Accounts.emailTemplates.verifyEmail template, which was getting called by CreateUser, but not showing up in the stack trace.

Marking this “solved.”

1 Like