为什么我的请求在本地工作而不在heroku上?

时间:2016-10-05 13:47:43

标签: ruby-on-rails-4 heroku rest-client

我在本地运行rake send_events并在heroku上运行heroku run rake send_events

values = {sendSmsRequest:
              {
                  from: "ABC",
                  to: "5581999999999",
                  msg: "msg",
                  callbackOption: "NONE",
                  id: "c_1541"
              }
}
headers = {
    :content_type => 'application/json',
    :authorization => 'Basic xxxxxxxxxxxxxxxxxxxxxxxx',
    :accept => 'application/json'
}


RestClient.post 'https://api-rest.zenvia360.com.br/services/send-sms', values.to_json, headers

日志打印 RestClient::Exceptions::OpenTimeout

感谢。

1 个答案:

答案 0 :(得分:0)

OpenTimeout表示rest-client尝试打开与服务器的连接超时。

您确定服务器已启动并且可以从heroku访问吗?我无法通过计算机或我尝试过的任何服务器访问它。

$ nc -w 10 -v api-rest.zenvia360.com.br 443
nc: connect to api-rest.zenvia360.com.br port 443 (tcp) timed out