收藏
回答

返回openid为undefined

官方的飞机例子,开启云开发后提示main.js:60 db get score catch error Error: document.get:fail document.get:fail cannot find document with _id undefined-score, please make sure that the document exists and you have the corresponding access permission

似乎open_id返回为undefined了

另外在同步云函数的时候返回失败了:

Error: 请在编辑器云函数根目录(cloudfunctionRoot)选择一个云环境

我没有找到cloudfunctionRoot这个目录,只有cloudfunction这个目录,并且云环境已经选择了,不知道为什么会出现这个错误。

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

1 个回答

  • 大飞Duffy
    大飞Duffy
    2022-12-29

    知道了,第一个问题通过打印知道了,结构变了,但是官方的代码还是旧的,所以window.openid的获取要改一下

    //window.openid = res.result.openid
    window.openid = res.result.userInfo.openId
    console.log(`login openid is:${JSON.stringify(res.result)}`)
    

    第二个是提示残留的问题,叉掉后就不会再提示了。

    2022-12-29
    有用
    回复 1
    • 大飞Duffy
      大飞Duffy
      2022-12-29
      但是还是提示错误,db get score catch error Error: document.get:fail document.get:fail cannot find document with _id oa4-XXXX(具体内容我省略了)-score, please make sure that the document exists and you have the corresponding access permission,不知道这个document道理是数据库的具体什么配置。按照查找的资料,设置了“所有用户可读,仅创建者可读写”之后,依然报这个错,不知道为什么
      2022-12-29
      回复
登录 后发表内容