【发布时间】:2020-07-13 10:29:54
【问题描述】:
我是 Meteor 的新手,我在本地机器上从 Heroku 克隆了 repo,然后用我现有的项目替换了 4 个文件夹(cleint server imports public)。
然后我运行meteor npm install,然后运行npm install,然后运行npm start。
项目运行顺利,我尝试注册用户,它成功但在登录时,它显示错误 ->
(node:11590) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded.
和
(node:14263) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 8)
我不知道,这个错误来自哪里,甚至尝试了关于同一问题的每个链接,但仍然没有任何效果。
我的登录码 ->
Meteor.call('affiliateLogin',values, (err,res)=>{
if(err){
console.log(' in catch and err -------- ')
console.log(err);
}
else{
console.log(' in response - res.data --- ')
console.log(res);
this.props.history.push("/dashboard");
}
});
而我的affiliateLogin 方法是->
affiliateLogin(values) {
console.log(' these are the values--- ', values) // i am getting the values here.
return axios({
method: 'post',
url: `${baseURL}/rest-api/affiliateAuthenticate.php`,
data: `userid=${values.email}&password=${values.password}&api_secret=secret`,
headers: {
'content-type': 'application/x-www-form-urlencoded',
}
})
.then(res => { return res.data })
.catch(err => { return err })
}
我的流星版->
meteor --version
Meteor 1.8.1
和Node版本->
node --version
v10.15.3
【问题讨论】:
-
promise 被拒绝,错误处理不当。您可以阅读文档中的
Meteor.wrapAsync和Meteor.bindEnvironment以获得更多帮助。