【问题标题】:Async / Await & Meteor code must always run within a FiberAsync / Await & Meteor 代码必须始终在 Fiber 中运行
【发布时间】:2017-10-03 08:10:50
【问题描述】:

我通过一些非常简单的代码得到了“Meteor 代码必须始终在 Fiber 中运行”。

const notif = async (userId, notifs) => {
  try {
    console.log('Notif Function Start');
    const template = await Assets.getText('email-new-appointment-client.html');
    return 'sent';
  } catch (error) {
    throw new Meteor.Error(500, 'notif functions', error);
  }
};

notif 是从 Meteor 方法中调用的函数。不涉及回调,不涉及第三方承诺库。

即使在同一个函数中运行以下命令也会导致光纤错误:

Email.send({
  to: uEmail,
  from: 'fake@email.com',
  subject: notifs.title,
  html: notifs.body,
});

【问题讨论】:

    标签: asynchronous meteor


    【解决方案1】:

    我从我的 .bablerc 文件中删除了“presets”:[“es2015”、“es2016”、“stage-0”、“react”],这里的错误就消失了。

    【讨论】:

    • 为我工作,删除“预设”:[“stage-1”]
    猜你喜欢
    • 2015-03-02
    • 2017-08-16
    • 1970-01-01
    • 2013-12-01
    • 2018-01-16
    • 2018-04-07
    • 1970-01-01
    • 1970-01-01
    • 2012-04-28
    相关资源
    最近更新 更多