4

we use Twilio (SMS sending platform) to send SMS via Parse Cloud Code. We create the following js method to perform that :

var client = require('twilio')(CONSTANTS.SMS_TWILIO_ACCOUNT_SID, CONSTANTS.SMS_TWILIO_AUTH_TOKEN);

function sendSMS(from, to, message, success, error) {
  
  console.log("from:" + from + " to:" + to + " message:" +message);

  client.sendSms({
    to:to,
    from: from,
    body: message
  }, function(err, responseData) {
    if (err) {
      error(err, responseData);
    } else {
      success(err, responseData);
    }
  });
}

This code work perfectly until this now. During this night, we received always the following error in Parse logs console :

{"status":0,"message":"Unable to complete HTTP request"}

On device, the error return by Parse contain code error 141 :

{"status":0,"message":"Unable to complete HTTP request"} (Code: 141, Version: 1.12.0)

I try to send SMS directly from Twilio Website and it work perfectly. Do think Parse have an issue with HTTP request send from Cloud Code?

Regards

Community
  • 1
  • 1
Greensource
  • 221
  • 2
  • 9
  • 1
    There is currently a known issue happening between Parse and Twilio. You can watch this Github issue for updates: https://github.com/twilio/twilio-node/issues/152. The issue also has work-around in the thread. – Devin Rader Feb 25 '16 at 14:03
  • 1
    Looks like Parse have also opened an issue on their end as well: https://developers.facebook.com/bugs/1696266953962575/ – Devin Rader Feb 25 '16 at 14:08
  • Running into this with my app as well - using programmable SMSes from Parse cloud code using the twilio module. Code did not change - this started happening a few hours ago. – Aphex Feb 25 '16 at 22:01

1 Answers1

2

Twilio Support here.

We have a temporary alternate endpoint in place that you can use: api.twilio.com:8443

Example:

Parse.Cloud.httpRequest({
    method: "POST",
    url: "https://{your AccountSID}:{your AuthToken}@api.twilio.com:8443/2010-04-01/Accounts/{your AccountSID}/Messages.json",
    body: {
        To: "",
        From: "",
        Body: ""
    }
}).then(
    function(httpResponse) {
        console.log(httpResponse.text); // SUCCESS
    },
    function(httpResponse) {
        console.log(httpResponse.text); // ERROR
    }
);
}
imthepitts
  • 1,647
  • 10
  • 9
  • Following up on this, Parse has now reverted the change to their certificates which should resolve the issue. This work-around should no longer be required. – Devin Rader Feb 26 '16 at 01:24