Meteor 服务器在 meteor 方法中抛出 Accounts.addEmail() 错误
Meteor server throws error with Accounts.addEmail() in a meteor method
我需要帮助弄清楚为什么会出现此错误。
我的方法在 app/server/methods.js
中定义
Meteor.methods({
myMethod: function(user) {
Accounts.addEmail(user._id, "thisemail@email.com", true); // set verified to true
}
});
我的模板有一个从客户端调用此方法的事件。
Template.myTemplate.events({
'click #this-button': function(e) {
Meteor.call("myMethod", userObject, function(error, result) {
if (error) {
console.log(error);
} else {
// do something here
}
});
}
});
我不断收到Internal Server Error [500]
错误返回到控制台。当我检查我的服务器输出时,它说: Exception while invoking method 'myMethod' TypeError: Object #<Object> has no method 'addEmail'
.
谁能帮我弄清楚为什么找不到/使用它?
这些是我正在使用的软件包列表,我认为根据这里的 Meteor 文档,它与帐户密码包一起打包。
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
如果我正确阅读了提交历史记录,看起来addEmail是作为meteor 1.2的一部分添加在此处的。
文档始终引用最新版本,但您的应用使用的是版本 1.1,这解释了缺少的功能。
解决方案可能像运行meteor update
一样简单,但是accounts-entry
是古老的,它可能与流星1.2不兼容,如本期所述。
如果您不能或不想更新,只需发表评论,我可以建议替代实现。
- Meteor's Accounts.onEmailVerificationLink与React和React路由器
- 如何使用ian:accounts-ui-botstrap-3根据Meteor中的用户输入设置配置文件字段值
- Accounts.createUser问题.如何使电子邮件字段不唯一
- Accounts.onCreateUser 未将字段添加到 Meteor 的用户集合中
- Meteor 服务器在 meteor 方法中抛出 Accounts.addEmail() 错误
- Meteor Accounts.ui.config 不与 Google 合作
- 我应该如何在后续登录时更新user.profile(类似于Accounts.onCreateUser)
- Meteor调用服务器上的Accounts.verifyEmail
- 当Accounts.createUser抛出错误时,Meteor模板重新呈现
- Accounts.createUser函数后未激发Meteor Template.myTemplate.rendered
- 如何删除“/向上”;在accounts-ui-botstrap-3登录按钮下拉列表中:forbidClientAccou
- XMLHttpRequest不能加载https://accounts.google.com/o/oauth2/token
- 不能使用Accounts.onCreateUser添加用户属性
- 获取/获取注册令牌(从accounts . sendregistrmentemail)
- Weird bug with Accounts.onCreatedUser
- 如何处理Meteor.js Accounts.registerLoginHandler中的异步代码
- “user.profile” 未定义,尽管它在 Accounts.createUser() 中声明
- Meteor Accounts.emailTemplates.resetPassword.html
- 在accounts-ui-bootstrap-3中没有下拉菜单