I need help figuring out why I am getting this error.
My method is defined in app/server/methods.js
Meteor.methods({ myMethod: function(user) { Accounts.addEmail(user._id, "thisemail@email.com", true); // set verified to true } });
My template has an event that is calling this method from the client.
Template.myTemplate.events({ 'click #this-button': function(e) { Meteor.call("myMethod", userObject, function(error, result) { if (error) { console.log(error); } else { // do something here } }); } });
I keep getting an Internal Server Error [500]
error back to the console.
When I check my server output it says:
Exception while invoking method 'myMethod' TypeError: Object #<Object> has no method 'addEmail'
.
Can anyone help me figure out why it can’t be found/used?
These are the list of packages I am using, and I thought this came packaged with the accounts-password package according to the Meteor Documentation here.
meteor-platform
iron:core
iron:router
less
zimme:iron-router-active
tomi:upload-server
tomi:upload-jquery
houston:admin
coffeescript
alanning:roles
edgee:slingshot
joshowens:accounts-entry
mystor:device-detection
underscore
email
accounts-password
Advertisement
Answer
If I’m reading the commit history correctly, it looks like addEmail was added here as part of meteor 1.2.
The docs always reference the latest version, but your app is using version 1.1, which explains the missing function.
The solution may be as simple as running meteor update
, however accounts-entry
is ancient and it may be incompatible with meteor 1.2, as noted in this issue.
If you can’t or don’t want to update, just leave a comment and I can suggest an alternative implementation.