收藏
回答

云开发调用订阅消息发送时返回异常?

云函数本地调试 network 包含异常接口请求返回结果如下:

{"code":"DEBUGGER_SERVER_INTERNAL_ERROR","message":"Debugger Server Internal Network Error: Fail to request http://tcb-open.tencentcloudapi.com/admin?&eventId=18cb9cc178e_2a&seqId=18cb9cc178e_2a via proxy null: Error: connect EHOSTUNREACH 169.254.0.131:443"}

调用代码如下

let cloud = cloudBase.getCloud();
cloud.openapi.subscribeMessage.send({
   touser: this._openId.split('^^^')[1],  // 要推送的用户openid
   templateId: '', // 模板ID
   page: "pages/inoculation/inoculation", // 要跳转的小程序界面
   data: {
      thing1: {
         value: "预约新冠疫苗"
      },
      time2: {
         value: "2019年10月1日 15:01"
      },
      thing3: {
         value: "您可以接种下一针疫苗啦!"
      },
      thing4: {
         value: '门店'
      },
      thing5: {
         value: '服务'
      },
   }, //模板数据填充部分
   miniprogramState: 'developer' //小程序类型,默认为正式版,这里设置为开发者模式
}).then(data => {
   console.error(data)
}).catch(e => {
   console.error(e)
});


catch 打印异常如下:

Error: errCode: -501001 resource system error | errMsg: openapi.subscribeMessage.send:fail  500 Internal Server Error | [http://tcb-open.tencentcloudapi.com/admin?&eventId=18cb9cc178e_2a&seqId=18cb9cc178e_2a]; at openapi.subscribeMessage.send api; 

    at returnAsCloudSDKError (E:\Project-Bq\TurBoYoga-master\cloudfunctions\mcloud\node_modules\.pnpm\registry.npmmirror.com+wx-server-sdk@2.1.2\node_modules\wx-server-sdk\index.js:6187:16)

    at Object.returnAsFinalCloudSDKError (E:\Project-Bq\TurBoYoga-master\cloudfunctions\mcloud\node_modules\.pnpm\registry.npmmirror.com+wx-server-sdk@2.1.2\node_modules\wx-server-sdk\index.js:6201:15)

    at callWXOpenAPI (E:\Project-Bq\TurBoYoga-master\cloudfunctions\mcloud\node_modules\.pnpm\registry.npmmirror.com+wx-server-sdk@2.1.2\node_modules\wx-server-sdk\index.js:2262:27)

    at processTicksAndRejections (node:internal/process/task_queues:96:5)


究竟是哪里出现了问题?

回答关注问题邀请回答
收藏
登录 后发表内容