6***@qq.com
6***@qq.com
  • 发布:2023-09-02 13:24
  • 更新:2023-09-02 19:40
  • 阅读:215

云对象url化本地测试能返回数据库数据,使用url请求就获取不到数据

分类:uniCloud
const db = uniCloud.database()  
module.exports = {  
    _before: function () { // 通用预处理器  

    },  
    async get(){  
        let res = await db.collection("test").get()  
        let result = {  
            errCode: 0,  
            errMsg: '查询成功',  
            data: res.data  
        }  
        return result  
    }  
}

本地云对象返回结果:

{  
    "errCode": 0,  
    "errMsg": "查询成功",  
    "data": [{  
        "_id": "64f2c2a121821b2af53905c4",  
        "title": "测试数据1"  
    }, {  
        "_id": "64f2c2a999c624654340e577",  
        "title": "测试数据2"  
    }]  
}

https://{阿里云通用url}/user/get
返回的结果:

{  
    "success": false,  
    "error": {  
        "code": "FunctionBizError",  
        "message": "\"/\" is not a valid cloudobject path"  
    }  
}

明明能拿到数据,为啥使用url就获取不到数据了

2023-09-02 13:24 负责人:无 分享
已邀请:
季兆星

季兆星 - 念念堂

遇到了同样的问题
[im-chat-api/ac1cd36d1693651595276133635/3ms/ERROR] "/" is not a valid cloudobject path
Error: "/" is not a valid cloudobject path
at o (/tmp/function/index.js:1:1061)
at i (/tmp/function/
index.js:1:1547)
at c (/tmp/function/index.js:1:2331)
at exports.main (/tmp/function/
index.js:1:2821)
at Q (/tmp/function/index.js:1:24206)
at z (/tmp/function/index.js:1:25269)
at ae (/tmp/function/index.js:1:26239)
at runUserFunction (/code/index.js:98:229657)
at (<anonymous>)
请求响应状态: fail

  • 6***@qq.com (作者)

    对的,日志里面一直是这个错误,这个翻译过来:"/"是无效的云对象路径,但是明明都配置好了路径,也没有客服啥的能问一下

    2023-09-02 19:21

季兆星

季兆星 - 念念堂

我提bug了

要回复问题请先登录注册