error is: Error: errCode: -501001 resource system error | errMsg: subscribeMessage.send:fail unknown response [object Object]
at new CloudSDKError (E:\web\wei_bhliber\cloudfunctions\subscribeMessage\node_modules\wx-server-sdk\index.js:6398:28)
at Object.<anonymous> (E:\web\wei_bhliber\cloudfunctions\subscribeMessage\node_modules\wx-server-sdk\index.js:450:31)
at step (E:\web\wei_bhliber\cloudfunctions\subscribeMessage\node_modules\tslib\tslib.js:136:27)
at Object.next (E:\web\wei_bhliber\cloudfunctions\subscribeMessage\node_modules\tslib\tslib.js:117:57)
at fulfilled (E:\web\wei_bhliber\cloudfunctions\subscribeMessage\node_modules\tslib\tslib.js:107:62)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
本地调试的没问题,一到云端调试就是这个报错,有大佬知道这报错是什么问题吗?
云函数里面的代码如下:
var sendM = async (row) => {
console.log('准备推送通知')
try {
const sendmessage = await cloud.openapi.subscribeMessage.send({
touser: row._openid,
data: {
date1: {
value: row.return_date,
},
number2: {
value: row.bookNum,
}
},
templateId: 'aSDrx2vaJfEh-YqS0tzfIB6EEsJoWrR0cJ4m9pIF1hM'
})
console.log('正在发送消息')
} catch (error) {
console.log("error is:",error)
}
}
exports.main = async (event, context) => {
await questionDB.where({
formid_settime: _.lt(today),
pushed:false
}).get()
.then((res) => {
if (res.data.length===0) {
console.log('没有数据')
return false
}
res.data.forEach(async (item)=>{
console.log('遍历读者数组')
await sendM(item)
// 此处async/await加不加都报错
})
}
)
}
我也在云函数中调用这个,也发现了这个问题
{
"errCode": -501001,
"errMsg": "subscribeMessage.send:fail unknown response [object Object]"
}