简体   繁体   English

当我运行代码通过Nexmo发送消息时收到此错误。 消息已发送,但此之后发生此错误

[英]getting this error when i run the code to send message through Nexmo. message is sent but after that this error occurs

未捕获的异常回调不是函数{“ stack”:“ TypeError:回调不是回调函数(/home/akkastech/backend-api/node_modules/nexmo/src/index.js:171:23)\\n HttpClient.callback [as __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_read.js:1055: 12)\\ n在_combinedTickCallback(内部/进程/next_tick.js:138:11)\\n在process._tickCallback(内部/process/next_tick.js:180:9)“}

it looks like you're passing something as a callback parameter that's not actually a function. 看起来您正在传递某些东西作为实际上不是函数的回调参数。 It should look like this: 它看起来应该像这样:

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']}`);
        }
    }
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 chrome 中检查代码时收到错误消息 - getting error message when inspecting code in chrome 在消息发送“抛出新错误('undefined 不是有效的 uri 或选项 object。')”后,我不断收到此错误 - I keep on getting this error after the message has sent "throw new Error('undefined is not a valid uri or options object.')" 无法向特定的 discord 服务器发送消息,出现代码错误 - Can't send a message to a specific discord server, getting code error 当我使用 message.htmlView 在 adonis js 中发送邮件时出现错误 - I have getting error when i'm using message.htmlView to send mail in adonis js 仅在发生错误时调用div显示错误消息 - Call the div displaying error message only when error occurs 为什么我在系统中第一次运行 react js 项目时收到此错误消息? - Why I am getting this error message when I run react js project first time in my system? 使用 nexmo npm 包从服务器获取错误以发送短信 - Getting error from server using nexmo npm package to send SMS 验证:发生错误时删除自定义成功消息 - Validate: remove custom success message when error occurs 发生错误时如何使“正在加载”消息消失? - How to make 'Loading' message disappear when an error occurs? php代码不运行吗?没有错误信息 - Does php code not run?No error message
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM