解析服务器 Twilio 未初始化
Parse-server Twilio not initializing
我已经在 ubuntu 16.0 上建立了一个 nodejs 应用程序。我使用 npm 安装它并配置了所有必需的依赖项。现在一切正常。云代码功能正在运行并在数据库中添加数据。
现在我的问题是我正在使用 twilio 向用户发送确认短信。以下是我的代码:
console.log("call 6");
var twilio = require("twilio")("A123456789123456789123456789123456", "a1234567891234567891234567891234");
console.log("call 7");
twilio.sendMessage({
From: "+1 123-456-7890",
To: request.params.number,
Body: "Enter 123 to verify your phone number..."
}, function (err, responseData) {
if (err) {
response.error("Error:" + err.message);
} else {
response.success("Success");
}
});
现在 "call 6" 显示在日志中,但 "call 7" 不显示,此函数没有通过任何响应。我从 iPhone 调用它,它一直在等待响应并抛出请求超时。
我已经解决了这个问题并发布在这里,这样如果其他人遇到这个错误。我正在使用 parse 中的 parse-server-example 项目并在其中添加 parse-server 作为依赖项。在 parse-server-example 而不是 parse-server 中安装 twilio 解决了我的问题。
我已经在 ubuntu 16.0 上建立了一个 nodejs 应用程序。我使用 npm 安装它并配置了所有必需的依赖项。现在一切正常。云代码功能正在运行并在数据库中添加数据。 现在我的问题是我正在使用 twilio 向用户发送确认短信。以下是我的代码:
console.log("call 6");
var twilio = require("twilio")("A123456789123456789123456789123456", "a1234567891234567891234567891234");
console.log("call 7");
twilio.sendMessage({
From: "+1 123-456-7890",
To: request.params.number,
Body: "Enter 123 to verify your phone number..."
}, function (err, responseData) {
if (err) {
response.error("Error:" + err.message);
} else {
response.success("Success");
}
});
现在 "call 6" 显示在日志中,但 "call 7" 不显示,此函数没有通过任何响应。我从 iPhone 调用它,它一直在等待响应并抛出请求超时。
我已经解决了这个问题并发布在这里,这样如果其他人遇到这个错误。我正在使用 parse 中的 parse-server-example 项目并在其中添加 parse-server 作为依赖项。在 parse-server-example 而不是 parse-server 中安装 twilio 解决了我的问题。