简体   繁体   中英

Parse-server Twilio not initializing

I have established a nodejs application on ubuntu 16.0. I installed it using npm and configured all required dependencies. Now everything is working fine. Cloud code functions are working and adding data in database. Now my problem is that I am using twilio to send confirmation sms to user. Following is my code:

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");
   }
});

Now "call 6" is shown in the logs but "call 7" does not show and this function did not through any response. I am calling it from iPhone and it keeps waiting for the response and throws request time out.

I have solved this and posting here so that if someone else stuck with this error. I was using parse-server-example project from parse and added parse-server in it as dependency. After installing twilio in parse-server-example rather than parse-server solved my issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM