收藏
回答

云调用服务端API storage.setUserInteractiveData 报错 604104

框架类型 问题类型 终端类型 AppID 环境ID 基础库版本
小游戏 Bug 工具 wx59415317c4ef6ae8 debug-8g7v39d9be7e8397 2.19.2

本地调试接口 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-26
回答关注问题邀请回答
收藏

1 个回答

  • 八云空幻
    八云空幻
    2021-09-27

    发现问题了 我这里是因为本地调试出问题了 直接调用是正常的

    2021-09-27
    有用
    回复
登录 后发表内容
问题标签