- 当前 Bug 的表现(可附上截图)
日志:
START RequestId: d9cd0067-5bfb-11e9-8210-5254005d5fdb
Event RequestId: d9cd0067-5bfb-11e9-8210-5254005d5fdb
2019-04-11T01:48:06.326Z d9cd0067-5bfb-11e9-8210-5254005d5fdb { Error: errCode: -604101 function has no permission to call this API | errMsg: system error: error code: -604101
at new CloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:4332:28)
at /var/user/node_modules/wx-server-sdk/index.js:2072:43
at step (/var/user/node_modules/tslib/tslib.js:133:27)
at Object.next (/var/user/node_modules/tslib/tslib.js:114:57)
at fulfilled (/var/user/node_modules/tslib/tslib.js:104:62)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
errCode: -604101,
errMsg: 'system error: error code: -604101' }
END RequestId: d9cd0067-5bfb-11e9-8210-5254005d5fdb
Report RequestId: d9cd0067-5bfb-11e9-8210-5254005d5fdb Duration:260ms Memory:256MB MaxMemoryUsed:0.386719MB
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
新建sum云函数
添加index.js代码如下
const cloud = require( 'wx-server-sdk' ) cloud.init() exports.main = async (event, context) => { try { const result = await cloud.openapi.customerServiceMessage.send({ touser: 'ohj0F5nTFfAtw7YT7cSkutKAlF24' , msgtype: 'text' , text: { content: 'Hello World' } }) console.log(result) return result } catch (err) { console.log(err) return err } } |
- 添加config.json
{ "permissions": { "openapi": ["customerServiceMessage.send"] } } |
-
右键 “上传并部署:所有文件”
-
右键 “上传并部署:云端安装依赖”
6. 点击页面上的“测试云函数”
IDE的问题,https://developers.weixin.qq.com/miniprogram/dev/devtools/rc.html 用4月9日这个版本重新上传部署,之前3月25日那个版本实际上是不行的,估计官方自己都没仔细测试过。。。