收藏
回答

微信开发者工具中,是用模拟器无法正常调用wx.cloud.CDN,应如何解决?

开发者工具版本:1.06.2401020

操作系统:Windows10

我在使用如下代码调用云函数并使用CDN传输文件:

wx.cloud.callFunction({
      name'quickstartFunctions',
      data: {
        type: 'getAnswer',
        img: wx.cloud.CDN({
           type: 'filePath',
           filePath: url,
         }),
        question: inputContent
      },
......


使用开发者工具的模拟器会报错:

[云函数] [getAnswer] 调用失败 Error: cloud.callFunction:fail undefined . uploadToCommonCDN:fail parse cdn resp buffer error Error: unrecognized resp object key type undefined
    at nr (WASubContext.js?t=wechat&s=1725808408075&v=2.20.1:2)
    at rr (WASubContext.js?t=wechat&s=1725808408075&v=2.20.1:2)
    at WASubContext.js?t=wechat&s=1725808408075&v=2.20.1:2
    at Generator.throw (<anonymous>)
    at n (WASubContext.js?t=wechat&s=1725808408075&v=2.20.1:2)
    at l (WASubContext.js?t=wechat&s=1725808408075&v=2.20.1:2)

下面是网络请求报错信息:

Request URL: http://CDN

Request Headers:
Provisional headers are shown

Request Payload:
{filePath: "http://tmp/rdxFGzk3uahOd78b4287975f056a796186c9d5cae708.jpg"}
filePath: "http://tmp/rdxFGzk3uahOd78b4287975f056a796186c9d5cae708.jpg"


但是在真机中运行却是正常的,麻烦问下是什么问题?

回答关注问题邀请回答
收藏

2 个回答

  • 🌏
    🌏
    09-10

    我遇到了同样问题,windows开发者模拟器报错

    Error: cloud.callFunction:fail undefined . uploadToCommonCDN:fail parse cdn resp buffer error Error: unrecognized resp object key type undefined

    真机正常

    09-10
    有用 1
    回复 2
    • BG9CXN
      BG9CXN
      09-10
      我怀疑这是模拟器的bug,但是我没证据...
      09-10
      回复
    • 王蒜蒜
      王蒜蒜
      星期四 09:19
      你好 请问解决了嘛
      星期四 09:19
      回复
  • 王蒜蒜
    王蒜蒜
    星期二 17:01

    我也遇到了

    Error: cloud.callFunction:fail undefined . uploadToCommonCDN:fail parse cdn resp buffer error Error: unrecognized resp object key type undefined

    真机和线上是正常的


    星期二 17:01
    有用
    回复
登录 后发表内容