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',
value: 0,
}]
})
})
}
config.json:
{
"permissions": {
"openapi": [
"storage.setUserInteractiveData"
]
}
}
本地调试报错:
node.js:1
- [error] Unhandled Rejection at: Promise {<rejected>: Error: errCode: -604104 | errMsg: system error: error code: -604104
- at Object.callWXOpenAPI (D…}
- __proto__: Promise
- [[PromiseStatus]]: "rejected"
- [[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)
- errCode: -604104
- errMsg: "system error: error code: -604104"
- message: "errCode: -604104 | errMsg: system error: error code: -604104"
- 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)"
- get message: ƒ get()
- set message: ƒ set(msg)
- __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
按照文档操作,本地调试报错
请问该问题是否还存在?请前往“做个小游戏”公众号对话框反馈一下,带上帖子的链接和标题,我们将会对您的疑问进行解答。
我是调用setUserStorage 本地调试也报这个