云函数发送消息提示no permission
- 当前 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[代码][代码] [代码][代码]}[代码][代码]}[代码]3. 添加config.json [代码]{[代码][代码] [代码][代码]"permissions": {[代码][代码] [代码][代码]"openapi": ["customerServiceMessage.send"][代码][代码] [代码][代码]}[代码][代码]}[代码]4. 右键 “上传并部署:所有文件” 5. 右键 “上传并部署:云端安装依赖” 6. 点击页面上的“测试云函数”