收藏
回答

生成二维码并保存云存储中,uploadFile总报错,但报错信息看不懂

问题模块 框架类型 问题类型 终端类型 AppID 基础库版本
云开发 小程序 Bug 客户端 wx5f7a32607d6c48c1 2.7.1

- 当前 Bug 的表现(可附上截图)

2019-06-05T14:54:51.897Z  { Error: errCode: -1 unknown error | errMsg: uploadFile:fail TypeError: source.on is not a function; at uploadFile api;

at new CloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6173:28)

at returnAsCloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6225:16)

at Object.returnAsFinalCloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6239:13)

at Cloud.<anonymous> (/var/user/node_modules/wx-server-sdk/index.js:2703:62)

at step (/var/user/node_modules/tslib/tslib.js:133:27)


- 预期表现

生成商家二维码并保存云存储中

- 复现路径


- 提供一个最简复现 Demo

exports.main = async (event, context) => {

try {


let imgBuf = await cloud.openapi.wxacode.getUnlimited({

page: "pages/seller/seller",

scene: "?sellerId=71f2cd945cb0b2e304fc61",

width: 160,

autoColor: false,

lineColor: { "r": 87, "g": 134, "b": 100 },

isHyaline: true

})


const result = await cloud.uploadFile({

cloudPath: '71f2cd945cb0b2e304fc6126353113**/code.png',

fileContent: imgBuf

})


return result


} catch (err) {

console.log(err)

return err

}

}


最后一次编辑于  06-05
回答关注问题邀请回答
收藏

1 个回答

  • 无何有
    无何有
    06-06

    已解决,疏忽了,应该是imgBuf.buffer

    06-06
    赞同
    回复 1
    • 
      
      06-06

      好的

      06-06
      回复