Meteor.js iron:路由器服务器路由触发RangeError:最大调用堆栈大小超出
Meteor.js iron:router server route triggers RangeError: Maximum call stack size exceeded
我正在我的服务器上设置一个Stripe webhook路由,并直接从readme中复制了铁路由器的代码,但是当我从Stripe发送测试webhook到我的服务器时,我得到了RangeError。
我的路由是这样定义的:
Router.route('/webhooks/stripe', { where: 'server' })
.get(function () {
// GET /webhooks/stripe
console.log("Get request from stripe")
})
.post(function () {
// POST /webhooks/stripe
console.log("Received POST Webhook from Stripe");
console.log(this);
this.response.end('webhook ended');
})
.put(function () {
// PUT /webhooks/stripe
console.log("Put request from stripe")
})
我也试过这样定义路由:
Router.map(function(){
this.route("webhooks", {layoutTemplate:null, path:'/webhooks/stripe', where:"server"}).post(function () {
// POST /webhooks/stripe
console.log("Received POST Webhook from Stripe");
console.log(this);
// // NodeJS response object
// var response = this.response;
this.response.end('webhook ended');
})
})
我正在使用ultrahook将测试webhook转发到我的本地开发机器。除了上面的错误打印一次外,我没有得到任何控制台输出。我也试过使用Chrome扩展邮差到达端点,我收到同样的错误。
更新:还尝试了这个路由定义没有改变
Router.route('/webhooks/stripe', function () {
var req = this.request;
var res = this.response;
res.end('hello from the server'n');
}, {where: 'server'});
我必须做错了什么,但我没能找到一个例子,确实为我工作。
好的,所以我花了永远看这个之前,我张贴了这个,事实证明,我真的只需要改变我的onBeforeAction调用排除服务器路由。
我Router.onBeforeAction(requireLogin, {except:["home"]});
,我需要把它改成
Router.onBeforeAction(requireLogin, {except:["home", "webhooks"]});
我的requireLogin方法是这样的:
var requireLogin = function() {
if (! Meteor.user()) {
if (Meteor.loggingIn()) {
this.render(this.loadingTemplate);
}else{
Router.go('/');
this.next();
}
} else {
this.next();
}
};
相关文章:
- 是什么让一个“;Uncaught RangeError:超过了最大调用堆栈大小“;错误(Chrome,在其他浏览器中显示
- 超过了async.detect最大调用堆栈大小
- 如何远程检查JavaScript应用程序的函数调用堆栈
- 超过了最大调用堆栈大小,循环无限
- 超过了最大调用堆栈大小.递归标签
- 日志:未捕获的范围错误:超过了最大调用堆栈大小
- 未捕获的范围错误:setTimeout()超过了最大调用堆栈大小
- JavaFX+WebView/Javascript:setTimeOut不起作用调用堆栈来自Java
- JavaScript继承:未捕获的范围错误:超过了最大调用堆栈大小
- 使用$cookies和$stateChangeStart检查sessionID是否超过了最大调用堆栈
- jQuery捕获"RangeError:超过了最大调用堆栈大小“;
- 设置这个.RangeError:超过了最大调用堆栈大小
- 收到“范围错误: 超出最大调用堆栈大小”错误
- 递归 - 测试最大堆栈大小时,调用堆栈无法弹出
- 轮询 ajax 函数超出调用堆栈
- Chrome RangeError:使用jQuery$.map时超过了最大调用堆栈大小
- 要求JS 2.1.9引起“;最大调用堆栈"使用Grunt时出错
- Chrome/jQuery未捕获范围错误:超过了最大调用堆栈大小(函数循环)
- 超过了最大调用堆栈大小-没有明显的递归
- 警告:字体加载过程中出错:轨道上的PDFJS超过了最大调用堆栈大小错误