收藏
回答

订阅消息发不出去

https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html


const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  // const wxContext = cloud.getWXContext(),
  try {
    const result = await cloud.openapi.subscribeMessage.send({
      touser: 'oJpod5PFl0DyJdSTWk8ksqbX7ZcQ',
      page: 'pages/index/index',
      data: {
        time1: {
          value: '2020-12-31'
        },
        thing3: {
          value: '麻辣酱'
        },
        thing4: {
          value: '测试'
        },
        number2: {
          value: '30'
        }
      },
      templateId: 'tydEgW60mqiPDmY4Pj03qdUYuxcEtb-PKzH_URKmOCU'
    })
    console.log(result)
    return result
  } catch (err) {
    console.log(err)
    return err
  }
}


返回的结果是这样的,谁能帮忙解读一下我错在哪里了吗?


msgERROR RequestId:deba5fc1-2f9a-11ea-90a7-5254002fa145 Result:{"errCode":1,"errMsg":"user code exception caught","stackTrace":"Unexpected token try"}


Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID , cloud function service error code -504002, error message Unexpected token try; at cloud.callFunction api; 



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

1 个回答

  • Tommy
    Tommy
    2020-01-05

    已解决。是参数格式不对

    2020-01-05
    有用
    回复
登录 后发表内容
问题标签