未捕获的异常回调不是函数{“ stack”:“ TypeError: 回调不是回调函数\ n (/home/akkastech/backend-api/node_modules/nexmo/src/index.js:171:23)\n 在HttpClient.callback [作为__parseResponse] (/home/akkastech/backend-api/node_modules/nexmo/src/HttpClient.js:181:7)\n 在IncomingMessage处。__parseResponse (/home/akkastech/backend-api/node_modules/nexmo/src/HttpClient.js:93:16)\n 在emitNone(events.js:111:20)\ n在IncomingMessage.emit (events.js:208:7)\ n在endReadableNT (_stream_visible.js:1055:12)\ n在_combinedTickCallback (internal / process / next_tick.js:138:11)\ n在process._tickCallback (internal / process / next_tick.js:180:9)“}
答案 0 :(得分:2)
看起来您正在传递某些内容作为实际上不是函数的回调参数。它应该看起来像这样:
nexmo.message.sendSms(from, to, text, (err, responseData) => {
if (err) {
console.log(err);
} else {
if(responseData.messages[0]['status'] === "0") {
console.log("Message sent successfully.");
} else {
console.log(`Message failed with error: ${responseData.messages[0]['error-text']}`);
}
}
})