将应用程序部署到Heroku后出现错误。在当地它工作正常。我正在使用Sinatra和Wordnik API。
以下是代码:
require 'rubygems'
require 'sinatra'
require 'haml'
require 'json'
require 'wordnik'
Wordnik.configure do |config|
config.api_key = '6bdddbf6a24e7dbdf400407f4670ff071b7d92089d30451b1'
end
get '/word' do
resp = Wordnik.words.get_random_word(:hasDictionaryDef => 'true', :maxCorpusCount => 20, :minLength => 10)
result = JSON.parse(resp.to_json)
word = result["word"]
return word.to_s
end
heroku日志输出:
2011-12-14T20:21:17+00:00 app[web.1]: c:0003 p:0127 s:0007 b:0007 l:0003c8 d:0025e0 EVAL /usr/ruby1.9.2/bin/thin:19
2011-12-14T20:21:17+00:00 app[web.1]: c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :load
2011-12-14T20:21:17+00:00 app[web.1]: c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
2011-12-14T20:21:17+00:00 app[web.1]: ---------------------------
2011-12-14T20:21:17+00:00 app[web.1]: c:0001 p:0000 s:0002 b:0002 l:0003c8 d:0003c8 TOP
2011-12-14T20:21:17+00:00 app[web.1]: -- Ruby level backtrace information ----------------------------------------
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/thin:19:in `<main>'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/thin:19:in `load'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/bin/thin:6:in `<top (required)>'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:177:in `run_command'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:143:in `run!'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:80:in `start'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/server.rb:156:in `start'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/backends/base.rb:57:in `start'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/connection.rb:42:in `receive_data'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/connection.rb:57:in `process'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/connection.rb:74:in `pre_process'
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/connection.rb:74:in `catch'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/builder.rb:134:in `call'
2011-12-14T20:21:17+00:00 app[web.1]: /home/heroku_rack/lib/date_header.rb:14:in `call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/urlmap.rb:46:in `call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/urlmap.rb:52:in `block in call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:1334:in `call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:1403:in `synchronize'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:1334:in `block in call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/methodoverride.rb:24:in `call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/head.rb:9:in `call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.5/lib/rack/commonlogger.rb:20:in `call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-protection-1.1.4/lib/rack/protection/xss_header.rb:22:in `call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:871:in `invoke'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:871:in `catch'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:871:in `block in invoke'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:770:in `route!'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:770:in `each'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:771:in `block in route!'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:819:in `process_route'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:819:in `catch'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:788:in `route_eval'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:1212:in `block in compile!'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/wordnik-4.06.12/lib/wordnik/resource_modules/words.rb:291:in `get_random_word'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/typhoeus-0.3.3/lib/typhoeus/multi.rb:21:in `perform'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/typhoeus-0.3.3/lib/typhoeus/easy.rb:362:in `call'
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/typhoeus-0.3.3/lib/typhoeus/easy.rb:397:in `get_info_string'
2011-12-14T20:21:17+00:00 app[web.1]:
2011-12-14T20:21:17+00:00 app[web.1]: -- C level backtrace information -------------------------------------------
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby(rb_vm_bugreport+0x4f) [0x4fc29f]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x5324ae]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby(rb_bug+0xb1) [0x532611]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x49dcff]
2011-12-14T20:21:17+00:00 app[web.1]: /lib/libpthread.so.0 [0x7fa0d5aa2a80]
2011-12-14T20:21:17+00:00 app[web.1]: /lib/libc.so.6(strlen+0x30) [0x7fa0d4ef40b0]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby(rb_str_new_cstr+0xe) [0x4ac82e]
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/typhoeus-0.3.3/ext/typhoeus/native.so [0x7fa0d19591f2]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f4fc3]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4ecc33]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f2865]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby(rb_vm_invoke_proc+0x309) [0x4f4a19]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x41dfdb]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f4fc3]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4ecc33]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f2865]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f569e]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby(rb_funcall+0x23d) [0x4ea8ed]
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/typhoeus-0.3.3/ext/typhoeus/native.so [0x7fa0d1958255]
2011-12-14T20:21:17+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/typhoeus-0.3.3/ext/typhoeus/native.so [0x7fa0d1958713]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f4fc3]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4ecc33]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f2865]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby(rb_vm_invoke_proc+0x309) [0x4f4a19]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f5427]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby(rb_method_call+0x16f) [0x41e51f]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f4fc3]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4ecc33]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f2865]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby(rb_vm_invoke_proc+0x309) [0x4f4a19]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x41dfdb]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f4fc3]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4ecc33]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f2865]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f67d9]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f4fc3]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4ecc33]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f2865]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4e881a]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f4fc3]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4ecc33]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4e881a]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/rubyeventmachine.so(_ZN14EventMachine_t13_RunEpollOnceEv+0x359) [0x7fa0d34fe379]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/rubyeventmachine.so(_ZN14EventMachine_t3RunEv+0x4c) [0x7fa0d350171c]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x533c2f]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4ecc33]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby [0x4f2865]
2011-12-14T20:21:17+00:00 app[web.1]: /usr/ruby1.9.2/bin/ruby(ruby_run_node+0x1e) [0x41ca7e]
2011-12-14T20:21:17+00:00 app[web.1]: [NOTE]
2011-12-14T20:21:17+00:00 app[web.1]: You may have encountered a bug in the Ruby interpreter or extension libraries.
2011-12-14T20:21:17+00:00 heroku[router]: Error H13 (Connection closed without response) -> GET radiant-planet-1594.heroku.com/word dyno=web.1 queue= wait= service= status=503 bytes=
2011-12-14T20:21:17+00:00 heroku[web.1]: Process exited
2011-12-14T20:21:18+00:00 heroku[web.1]: State changed from up to crashed
如果您需要更多信息,请与我们联系。