收藏
回答

紧急wx.cloud.uploadFile 返回 fail url not in domain?

框架类型 问题类型 终端类型 AppID 环境ID 基础库版本
小程序 Bug 微信安卓客户端 wx9f66c7f0543a6f00 yzwdj 2.13.2

过去代码运行正常,最近两天发现所有的wx.cloud.uploadFile 运行都不正常

该函数在开发环境和真机测试环境都正常,但在真机运行环境下出现错误:

fail url not in domain list?

代码片段:

wx.cloud.uploadFile({ cloudPath: 'owner_sound/share/' + that.data.news_id + '/share.jpg', filePath: that.data.upload_local_url, // 本地文件路径 success: res => { that.getImgUrl(res.fileID) }, fail: err => { that.setData({ publisher_change: false, }) wx.hideLoading({           success: (res) => {             wx.showModal({               title: '封面图片上传失败!',               content: err.errMsg,               showCancel: false, })           },         }) } })


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

3 个回答

  • 周公子
    周公子
    2021-01-10

    你好,建议修改下 app.json

    https://developers.weixin.qq.com/minigame/dev/wxcloud/reference/compatibility.html


    2021-01-10
    有用
    回复 3
    • 陈怀俊
      陈怀俊
      2021-01-11
      是要在app.json中去除 clound:true 配置?
      2021-01-11
      回复
    • 周公子
      周公子
      2021-01-11回复陈怀俊
      嗯嗯
      2021-01-11
      回复
    • 西北狼
      西北狼
      2021-01-11
      今天下午提交了代码,最核心的图片上传功能不能用了。
      刚刚移除掉了cloud:true提交了代码,用户都在等待中,这不是误事吗。
      你小程序也不能提前检查一下,开发版、真机版、体验版也应该不能用才对啊。。。
      2021-01-11
      回复
  • ZiraLi
    ZiraLi
    发表于移动端
    2021-01-09
    收到,我们看下
    2021-01-09
    有用
    回复 1
    • brave
      brave
      2021-01-09
      忘记切号了!
      2021-01-09
      回复
  • 西北狼
    西北狼
    2021-01-11

    今天下午提交了代码,最核心的图片上传功能不能用了。

    刚刚移除掉了cloud:true提交了代码,用户都在等待中,这不是误事吗。

    你小程序也不能提前检查一下,开发版、真机版、体验版也应该不能用才对啊。。。

    2021-01-11
    有用
    回复 2
    • 周公子
      周公子
      2021-01-11
      你好,短期的方案,可以先到小程序后台,添加「uploadFile合法域名」:https://cos.ap-shanghai.myqcloud.com
      长期的方案:去掉 `app.json` 里的 `“cloud”: true` 配置项
      2021-01-11
      回复
    • 陈怀俊
      陈怀俊
      2021-01-11
      补充说明下:真机环境下,wx.cloud.uploadfile 参数还需增加 name:'名字',否则也不能上传,开发环境缺少工作都正常
      分享:13883166466
      2021-01-11
      回复
登录 后发表内容
问题标签