收藏
回答

求大佬指点wx.cloud.deleteFile的正确用法,不知道是bug还是什

deleteFileId 的值为 cloud://jsy-test-tk8xa.6a73-jsy-test-tk8xa-1258939113/storeCover-jsyf4244-1555987045932.jpg

deleteFileId 为之前 wx.cloud.uploadFile success的  res.fileID

console.log("typeof", (typeof deleteFileId))

wx.cloud.deleteFile({

    fileList: [deleteFileId],

    success: res => {

    console.log("删除成功,fileList",res.fileList)

    },

    fail: err => {

    console.log("删除失败,deleteFileId", deleteFileId,"err", err)

    }

})


控制台打印:

typeof string

删除失败,deleteFileId

err Error: errCode: -401003 api parameter type error | errMsg: parameter.fileList[clone] should be string instead of function;

    at new e (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:195271)

    at Object.t.assertType (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:194254)

    at http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:182499

    at http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:182832

    at http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:122438

    at Object.next (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:122543)

    at http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:121481

    at Promise (<anonymous>)

    at Module.l (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:121258)

    at r (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:182229)

    at e.(http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:182077)

    at Object.exportAPI.(anonymous function) [as deleteFile] (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:127385)

    at http://127.0.0.1:30738/appservice/pages/store/store.js:306:20

    at r (http://127.0.0.1:30738/appservice/utils/promise.js:1783:40)

    at i._settlePromiseFromHandler (http://127.0.0.1:30738/appservice/utils/promise.js:1143:206)

    at i._settlePromise (http://127.0.0.1:30738/appservice/utils/promise.js:1156:393)


最后一次编辑于  04-23  (未经腾讯允许,不得转载)
收藏关注问题回答
邀请回答

7 个回答

  • 祺爸💎
    祺爸💎
    04-23

    错误提示说的很清楚了

    parameter.fileList[clone] should be string instead of function

    04-23
    赞同
    回复 2
    • zhouxiaofu
      zhouxiaofu
      04-23

      console.log("typeof", (typeof deleteFileId))

      打印的是 typeof string 数组中我是给的字符串啊

      04-23
      赞同
      回复
    • zhouxiaofu
      zhouxiaofu
      04-23

      而且无论是我复制控制台打印的  deletefileId还是复制云开发控制台中文件的fileid 直接放到fileList中也是报这个错

      04-23
      赞同
      回复
    点击 登录
  • 邓坤力
    邓坤力
    04-23

    感谢反馈,这是我们的内部 bug,是否是在 Array.prototype 上挂了 clone 方法?如果是的请先避免修改 Array.prototype,后续这个问题会修复

    04-23
    赞同
    回复 3
    • zhouxiaofu
      zhouxiaofu
      04-23

      是的

      04-23
      赞同
      回复
    • zhouxiaofu
      zhouxiaofu
      04-23

      谢谢!非常感谢,这个问题困扰了我两天,报错的内容我也反复的去想,但是就是没想过是因为 Array.prototype 上挂了 clone的原因。

      04-23
      赞同
      回复
    • 邓坤力
      邓坤力
      04-23回复zhouxiaofu

      抱歉这是我们的失误,让你困扰了这么久

      04-23
      赞同
      回复
    点击 登录