发现问题了 我这里是因为本地调试出问题了 直接调用是正常的
云调用服务端API storage.setUserInteractiveData 报错 604104本地调试接口 storage.setUserInteractiveData, 提示错误信息 函数执行失败(耗时 198ms) Error: errCode: -604104 illegal source of invocation | errMsg: system error: error code: -604104 at callGeneralOpenAPI (\cloudfunctions\InteractiveDataTest\node_modules\wx-server-sdk\index.js:487:27) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async callWXOpenAPI (\cloudfunctions\InteractiveDataTest\node_modules\wx-server-sdk\index.js:2360:28) at async Worker.exports.main [as handler] (\cloudfunctions\InteractiveDataTest\index.js:10:11) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 这是我的权限文件config.json { "permissions": { "openapi": [ "storage.setUserInteractiveData" ] } } ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 代码片段: exports.main = async (event, context) => { const wxContext = cloud.getWXContext() let openID = wxContext.OPENID; let o = await cloud.openapi.storage.setUserInteractiveData({ openid: openID, kvList: [{ key: '1', value: 1, }] }) console.log(o); return o; } ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 目的:云函数可以设置用户的互动数据
2021-09-27