Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AccountsTemplates is not defined

Tags:

meteor

With a brand new windows installation of Meteor and the simplest of packages, I am getting

ReferenceError: AccountsTemplates is not defined

I am attempting to use the postSignUpHook feature, like so (tried in the base directory as well as /server/)

AccountsTemplates.configure({
  postSignUpHook: myPostSubmitFunc 
});

var myPostSubmitFunc = function(userId, info) {
  console.log("new user " + userId);
}

Here is the versions that have been installed using meteor install

meteor list
accounts-base         1.2.2  A user account system
accounts-password     1.1.4  Password support for accounts
accounts-ui           1.1.6  Simple templates to add login widgets to an app
alanning:roles        1.2.15  Authorization package for Meteor
blaze-html-templates  1.0.1  Compile HTML templates into reactive UI with
  Meteor Blaze
ecmascript            0.1.6* Compiler plugin that supports ES2015+ in all 
  .js files
es5-shim              4.1.14  Shims and polyfills to improve ECMAScript 5     
  support
insecure              1.0.4  (For prototyping only) Allow all database     
  writes from the client
jquery                1.11.4  Manipulate the DOM using CSS selectors
meteor-base           1.0.1  Packages that every Meteor app needs
mobile-experience     1.0.1  Packages for a great mobile user experience
mongo                 1.1.3  Adaptor for using MongoDB and Minimongo over     
  DDP
session               1.1.1  Session variable
standard-minifiers    1.0.2  Standard minifiers used with Meteor apps by     
  default.
tracker               1.0.9  Dependency tracker to allow reactive callbacks

From what I can tell AccountsTemplates is suppose to come from accounts-base, but I am having a hard time actually finding where it is created.

Also If i remember correctly, when you get missing reference errors like this it could be a problem with an incompatible package somewhere else unrelated? How do I go about debugging whats going on here?

like image 562
TheBeefiest Avatar asked Jan 17 '26 22:01

TheBeefiest


1 Answers

I guess I was confused because guide.meteor.com is assuming the use of useraccounts:flow-routing.

What I should be looking at is docs.meteor.com, in the accounts section.

Specifically I guess I will use Accounts.onLogin to add roles after a new user is created. I can not use AccountsServer#onCreateUser since the userId is not generated yet at that point.

(The docs.meteor.com actually has a seemingly erroneous AccountsCommon#onLogin, watch out for that, that method does not exist on AccountsServer)

like image 147
TheBeefiest Avatar answered Jan 19 '26 20:01

TheBeefiest



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!