Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 Heroku应用程序:RestClient::InternalServerError_Ruby On Rails 3_Heroku_Rest Client - Fatal编程技术网

Ruby on rails 3 Heroku应用程序:RestClient::InternalServerError

Ruby on rails 3 Heroku应用程序:RestClient::InternalServerError,ruby-on-rails-3,heroku,rest-client,Ruby On Rails 3,Heroku,Rest Client,我在myapp.heroku.com上创建了一个web应用程序,“myapp”实际上是heroku生成的随机名称。当我用我的网络浏览器点击它时,它就工作了。当我用Ruby Rest Client(gem Rest Client v1.6.3)点击它时,如下所示: irb(main):024:0> response=RestClient.get "http://myapp.heroku.com" 它与以下内容有关: RestClient::InternalServerError: 500

我在myapp.heroku.com上创建了一个web应用程序,“myapp”实际上是heroku生成的随机名称。当我用我的网络浏览器点击它时,它就工作了。当我用Ruby Rest Client(gem Rest Client v1.6.3)点击它时,如下所示:

irb(main):024:0> response=RestClient.get "http://myapp.heroku.com"
它与以下内容有关:

RestClient::InternalServerError: 500 Internal Server Error
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-    1.6.3/lib/restclient/abstract_response.rb:48:in `return!'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-1.6.3/lib/restclient/request.rb:228:in `process_result'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-1.6.3/lib/restclient/request.rb:176:in `block in transmit'
    from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:627:in `start'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-1.6.3/lib/restclient/request.rb:170:in `transmit'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-1.6.3/lib/restclient/request.rb:64:in `execute'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-1.6.3/lib/restclient/request.rb:33:in `execute'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-1.6.3/lib/restclient.rb:68:in `get'
    from (irb):24
    from C:/Ruby192/bin/irb:12:in `<main>'

它工作得很好

这里可能有很多原因

如果您使用的是单个dyno,它会发出请求,但随后会返回到站点,但没有dyno可用于处理请求,因此会超时

在某些情况下,服务器无法就其外部地址与自身通信,但我认为这种情况不太可能发生,更可能是dyno问题

约翰。

我搞错了

在检查“heroku日志”时,我发现我的代码中有一个异常导致了500错误。异常是因为heroku中的PG数据库和我的本地SQLite3数据库之间存在类型转换差异。一旦我修好了,一切都很顺利。我怀疑500错误还导致我的站点暂时无法访问,这就是为什么我的站点所在的子域没有返回任何内容的原因


这个故事的寓意是什么?rest客户端工作。希罗库工作。Rest客户端(IMO)不应该抛出500的异常,而应该返回HTTP响应代码,让应用程序处理它。但是,如果我再发牢骚,我还必须修复…

我的rest客户端软件正在我的计算机上运行。我使用的是一个dyno,但当我使用web浏览器点击应用程序时,它可以正常工作。另外,我的rest客户端与其他网站配合使用也很好。只是不是我的heroku应用程序。故事的寓意是在本地使用postgres来开发:)我很想在本地使用PG,但我还没有想出如何通过Windows将它连接到Ruby。
irb> require 'net/http'
irb> NET::HTTP.get_print URI.parse "http://myapp.heroku.com"