您的服务器端路由正在运行全局
onBeforeAction代码(在共享目录中定义),该代码会中断,因为服务器路由是不了解用户身份验证信息(即
Meteor.user()不起作用)的简单REST端点。解决方案是使用来包装特定于客户端的
onBeforeAction调用,
Meteor.isClient或者只是将该代码移动到
client目录下。例如:
if (Meteor.isClient) { Router.onBeforeAction(function () { if (!Meteor.user() || Meteor.loggingIn()) this.redirect('welcome.view'); else this.next(); } ,{except: 'welcome.view'} ); Router.onBeforeAction(function () { if (Meteor.user()) this.redirect('home.view'); else this.next(); } ,{only: 'welcome.view'} );}Router.route('/pdf-server', function() { ...}, {where: 'server'});


