收藏
回答

API sendHardwareDeviceMessage 是否支持云函数调用

框架类型 问题类型 终端类型 AppID 环境ID 基础库版本
小程序 Bug 工具 wxfa8ef18012f54150 muye-1g15f7t488fb4f6c 2.27.3

云函数中调用 sendHardwareDeviceMessage API 报错 -604100 API not found

请告知如何中云函数中如何正确使用sendHardwareDeviceMessage?


Error: errCode: -604100 API not found | errMsg: system error: error code: -604100

    at callGeneralOpenAPI (D:\workspace\WX\xbee\cloudfunctions\sent_notice\node_modules\wx-server-sdk\index.js:487:27)

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

    at async callWXOpenAPI (D:\workspace\WX\xbee\cloudfunctions\sent_notice\node_modules\wx-server-sdk\index.js:2364:28)

    at async d.exports.main [as handler] (D:\workspace\WX\xbee\cloudfunctions\sent_notice\index.js:211:22)

回答关注问题邀请回答
收藏

3 个回答

  • Mr.Zhao
    Mr.Zhao
    2023-07-03

    云调用不支持的,只能走https调用

    2023-07-03
    有用 1
    回复
  • 陈宇明
    陈宇明
    2023-07-06

    不支持

    2023-07-06
    有用
    回复
  • chang jiang
    chang jiang
    2023-07-03

     try {

          var datax = {

            "template_id": "9f_ioRXJ1LwX5r123FzIwUAVEr_QgY4VZNsFzvZOE_Y",

            "sn": status_report[index].onenet_id,

            "page": "page/map/map",

            "to_openid_list": [

              status_report[index].openid

            ],

            "modelId": "DD1EnNuPXeaKypIflweYvw",

            "lang": "zh_CN",

            "data": {

              "character_string2": {

                "value":status_report[index].onenet_id

              },

              "time1": {

                "value":alarm_time

              }

            }

          }

          var cloudlink = "https://api.weixin.qq.com/cgi-bin/message/device/subscribe/send"

          const resp = await Axios.post(cloudlink, datax)

          return resp

          console.log(resp)

        } catch (err{

          console.log(err)

          return err

        }

    帮忙大神看看代码, 这段代码本地云函数调试是成功的, 但是云端部署后报错

    {"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"TypeError: Converting circular structure to JSON\n --\u003e starting at object with constructor 'ClientRequest'\n | property 'socket' -\u003e object with constructor 'TLSSocket'\n --- property '_httpMessage' closes the circle\n at JSON.stringify (\u003canonymous\u003e)\n at callback (/var/runtime/node12/CallbackContext.js:31:23)\n at /var/runtime/node12/CallbackContext.js:81:16\n at /var/runtime/node12/Runtime.engine.js:237:13\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","statusCode":430}

    2023-07-03
    有用
    回复
登录 后发表内容
问题标签