Busboy 无法在 azure 函数中使用 async/await

问题描述

module.exports = async function (context,req) {
  const name = context.bindingData.name;
  contractAccount = await near.account(contractName)
  switch (name) {
        case 'get_sale':
            get_sale_func(context,req);
            break;
        default:
            break;
}

function get_sale_func(context,req) {
    const busboy = new Busboy({ headers: req.headers });
    busboy.on('field',function(fieldname,val) {
    });
    busboy.on('finish',function() {
        log('Done parsing form!');
        context.res = {
            status: 200,body: { result: "done" }
        };
    });
    busboy.write(req.body,function() {});
}

它不返回此响应。

context.res = {
  status: 200,body: { result: "done" }
};

enter image description here

但是如果我对第 3 行的此代码 contractAccount = await near.account(contractName) 发表评论,它会起作用。

enter image description here

有什么办法可以解决这个问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)