收藏
回答

【求助】云函数调用setUserInteractiveData报错

框架类型 问题类型 终端类型 AppID 环境ID 基础库版本
小游戏 Bug 工具 wxfb8d96639411767d server-pyoo2 Wechat Lib:2.10.3, 2020.3.21 23:32:34

index.js:

// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init(
  {env"server-pyoo2"}
)
// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  return new Promise ((resolve, reject) => {
    cloud.openapi.storage.setUserInteractiveData({
      openid: wxContext.OPENID,
      kvList: [{
        key'1',
        value0,
      }]
    })
  })
}

config.json:

{
  "permissions": {
    "openapi": [
      "storage.setUserInteractiveData"
    ]
  }
}

本地调试报错:

node.js:1

  1. [error] Unhandled Rejection at: Promise {<rejected>: Error: errCode: -604104 | errMsg: system error: error code: -604104
  2. at Object.callWXOpenAPI (D…}
  3. __proto__: Promise
  4. [[PromiseStatus]]"rejected"
  5. [[PromiseValue]]: Error: errCode: -604104 | errMsg: system error: error code: -604104 at Object.callWXOpenAPI (D:\Project\build\wechatgame\functions\getID\node_modules\wx-server-sdk\index.js:418:23) at processTicksAndRejections (internal/process/task_queues.js:85:5) at async callWXOpenAPI (D:\Project\build\wechatgame\functions\getID\node_modules\wx-server-sdk\index.js:2234:28)
  6. errCode-604104
  7. errMsg"system error: error code: -604104"
  8. message"errCode: -604104 | errMsg: system error: error code: -604104"
  9. stack"Error: errCode: -604104 | errMsg: system error: error code: -604104↵ at Object.callWXOpenAPI (D:\Project\build\wechatgame\functions\getID\node_modules\wx-server-sdk\index.js:418:23)↵ at processTicksAndRejections (internal/process/task_queues.js:85:5)↵ at async callWXOpenAPI (D:\Project\build\wechatgame\functions\getID\node_modules\wx-server-sdk\index.js:2234:28)"
  10. get messageƒ get()
  11. set messageƒ set(msg)
  12. __proto__: Error

reason: Error: errCode: -604104 | errMsg: system error: error code: -604104

at Object.callWXOpenAPI (D:\Project\build\wechatgame\functions\getID\node_modules\wx-server-sdk\index.js:418:23)

at processTicksAndRejections (internal/process/task_queues.js:85:5)

at async callWXOpenAPI (D:\Project\build\wechatgame\functions\getID\node_modules\wx-server-sdk\index.js:2234:28)

_@node.js:1(anonymous)@node.js:1emit@events.js:203processPromiseRejections@internal/process/promises.js:201processTicksAndRejections@internal/process/task_queues.js:86


internal/process/warning.js:27 

(node:45592) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

writeOut@internal/process/warning.js:27onWarning@internal/process/warning.js:79emit@events.js:203(anonymous)@internal/process/warning.js:52processTicksAndRejections@internal/process/task_queues.js:75TickObject (async)init@internal/inspector_async_hook.js:21emitInitNative@internal/async_hooks.js:134emitInitScript@internal/async_hooks.js:341TickObject@internal/process/task_queues.js:102nextTick@internal/process/task_queues.js:130emitWarning@internal/process/warning.js:130emitDeprecationWarning@internal/process/promises.js:153processPromiseRejections@internal/process/promises.js:204processTicksAndRejections@internal/process/task_queues.js:86


按照文档操作,本地调试报错

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

2 个回答

  • 小游戏运营专员 - 宏
    小游戏运营专员 - 宏
    2020-03-31

    请问该问题是否还存在?请前往“做个小游戏”公众号对话框反馈一下,带上帖子的链接和标题,我们将会对您的疑问进行解答。

    2020-03-31
    有用
    回复
  • 王兆旭
    王兆旭
    2020-04-21

    我是调用setUserStorage 本地调试也报这个

    2020-04-21
    有用
    回复
登录 后发表内容
问题标签