Problem with useraccounts:core


#1

Hello! I followed the Blaze tutorial I’ve made it to #10 publish & subscribe. (Perhaps not super related).

When trying to create a new account i get the following message:

Exception in delivering result of invoking 'ATCreateUserServer': TypeError: Cannot read property 'setError' of undefined

I’m using a semi-customized useraccounts:unstyled with these options (maybe related):

AccountsTemplates.removeField('password')
AccountsTemplates.removeField('email')
AccountsTemplates.addFields([
  {
      _id: "username",
      type: "text",
      displayName: " ",
      required: true,
      minLength: 3,
  },
  {
      _id: "password",
      type: "password",
      displayName: " ",
      required: true,
      minLength: 3,
  }
])

AccountsTemplates.configure({
  showLabels: false,
  texts: {
    errors: {
      accountsCreationDisabled: "Client side accounts creation is disabled!!!",
      cannotRemoveService: "Cannot remove the only active service!",
      captchaVerification: "Captcha verification failed!",
      loginForbidden: "error.accounts.Login forbidden",
      mustBeLoggedIn: "error.accounts.Must be logged in",
      pwdMismatch: "error.pwdsDontMatch",
      validationErrors: "Validation Errors",
      verifyEmailFirst: "Please verify your email first. Check the email and follow the link!",
    }
  },
})

My initial thought was that i needed to add some form of method or (publish / subscribe). But i read that it was already handled by the package. I also tried meteor add insecure & autopublish again. Still not working.

Any tips?


#2

Solved by putting AccountsTemplates options in root/lib/accounts-config.js

The problem was the code was only running on the client. The server didnt match up.