Luke Clifton
Luke Clifton

Reputation: 81

Meteor - Getting error when calling Accounts.onCreateUser

I'm getting the following error:

TypeError: Object [object Object] has no method 'onCreateUser'
at app/server/accounts.js:1:45
at app/server/accounts.js:6:3

When calling Accounts.onCreateUser in a file named accounts.js in my server folder

Accounts.onCreateUser(function(options, user) 
{
     return user;
});

Please can someone help explain what i'm doing wrong?

First week with Meteor! :)

Upvotes: 2

Views: 653

Answers (2)

Luke Clifton
Luke Clifton

Reputation: 81

Ok, embarrassing answer but thought i'd share in case any other newbies make the same mistake. I had created a collection with the name 'accounts' and this was causing a conflict and thus producing this error. I did not realise this was a reserved name in Meteor.

Upvotes: 1

Walter Zalazar
Walter Zalazar

Reputation: 541

Accounts depends the accounts-ui package,

A turn-key user interface for Meteor Accounts.

To add Accounts and a set of login controls to an application, add the accounts-ui package and at least one login provider package: accounts-password, accounts-facebook, accounts-github, accounts-google, accounts-twitter, or accounts-weibo.

http://docs.meteor.com/#accountsui

Upvotes: 0

Related Questions