收藏
回答

腾讯云wafer2 上传图片错误,代码502

将代码部署在腾讯云上后,上传图片失败,服务器的日志如下:

warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").

/data/release/node-weapp-demo/node_modules/wafer-node-sdk/lib/upload/index.js:113

                const hasBucket = data.Buckets && data.Buckets.reduce((pre, cur) => {

                                      ^


TypeError: Cannot read property 'Buckets' of undefined

    at cos.getService (/data/release/node-weapp-demo/node_modules/wafer-node-sdk/lib/upload/index.js:113:39)

    at _callback (/data/release/node-weapp-demo/node_modules/cos-nodejs-sdk-v5/sdk/util.js:333:25)

    at /data/release/node-weapp-demo/node_modules/cos-nodejs-sdk-v5/sdk/base.js:40:20

    at cb (/data/release/node-weapp-demo/node_modules/cos-nodejs-sdk-v5/sdk/base.js:2137:13)

    at Request.<anonymous> (/data/release/node-weapp-demo/node_modules/cos-nodejs-sdk-v5/sdk/base.js:2194:21)

    at emitOne (events.js:120:20)

    at Request.emit (events.js:210:7)

    at IncomingMessage.<anonymous> (/data/release/node-weapp-demo/node_modules/request/request.js:1085:12)

    at Object.onceWrapper (events.js:314:30)

    at emitNone (events.js:110:20)

    at IncomingMessage.emit (events.js:207:7)

    at endReadableNT (_stream_readable.js:1045:12)

    at _combinedTickCallback (internal/process/next_tick.js:138:11)

    at process._tickCallback (internal/process/next_tick.js:180:9)

配置如下:


图片上传的代码用的是demo里的,上传图片后控制台报错:
图片上传成功时的代码:


success: function (res) {

//showSuccess('上传图片成功')

console.log(res);

wx.showToast({

title: "上传图片成功",

duration: 800

})

res = JSON.parse(res.data)

that.setData({

imgUrl: res.data.imgUrl

})

},


最后一次编辑于  2018-06-18  (未经腾讯允许,不得转载)
邀请回答
复制链接收藏投诉关注问题回答

2 个回答

  • 邓坤力
    邓坤力
    2018-06-20

    麻烦给个相关的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),我们定位下问题

    2018-06-20
    赞同
    回复
  • 秋日私语
    秋日私语
    2018-07-07

    我把service/config.js里的appId去掉之后就可以上传图片了

    2018-07-07
    赞同
    回复