Rails应用程序甚至在部署时显示应用程序错误

时间:2018-02-13 16:40:53

标签: ruby-on-rails ruby heroku

My Rails应用程序代码位于https://github.com/gutoslv/One-Month-Rails。我将它部署到heroku而没有在日志上给出任何错误,但当我尝试使用链接https://omrails-gutoslv.herokuapp.com/访问它时,我得到了应用程序错误。

Bundler已经更新,但我无法看到错误的位置。

日志如下:

    2018-02-13T16:21:34.536807+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=omrails-gutoslv.herokuapp.com request_id=7b435235-1542-4356-b36c-e4c710f81548 fwd="179.228.208.76" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:21:54.921758+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=omrails-gutoslv.herokuapp.com request_id=e6ea5e62-eb18-4493-9069-bb603324082d fwd="179.228.208.76" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:29:18.453089+00:00 heroku[web.1]: State changed from crashed to starting
2018-02-13T16:29:23.704854+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 47008 -e production`
2018-02-13T16:29:29.534852+00:00 heroku[web.1]: State changed from starting to crashed
2018-02-13T16:29:29.520513+00:00 heroku[web.1]: Process exited with status 1
2018-02-13T16:29:29.401113+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
2018-02-13T16:29:29.401161+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:185:in `spec'
2018-02-13T16:29:29.401203+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `establish_connection'
2018-02-13T16:29:29.401236+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:58:in `establish_connection'
2018-02-13T16:29:29.401273+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
2018-02-13T16:29:29.401255+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railtie.rb:124:in `block (2 levels) in <class:Railtie>'
2018-02-13T16:29:29.401292+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
2018-02-13T16:29:29.401310+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
2018-02-13T16:29:29.401329+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
2018-02-13T16:29:29.401347+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
2018-02-13T16:29:29.401375+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each'
2018-02-13T16:29:29.401401+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
2018-02-13T16:29:29.401419+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/base.rb:326:in `<module:ActiveRecord>'
2018-02-13T16:29:29.401441+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/base.rb:25:in `<top (required)>'
2018-02-13T16:29:29.401461+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
2018-02-13T16:29:29.401479+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
2018-02-13T16:29:29.401497+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
2018-02-13T16:29:29.401514+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
2018-02-13T16:29:29.401701+00:00 app[web.1]:    from /app/app/models/application_record.rb:1:in `<top (required)>'
2018-02-13T16:29:29.401738+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
2018-02-13T16:29:29.401719+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
2018-02-13T16:29:29.401756+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
2018-02-13T16:29:29.401773+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
2018-02-13T16:29:29.401802+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:379:in `block in require_or_load'
2018-02-13T16:29:29.401831+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `block in load_interlock'
2018-02-13T16:29:29.401850+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
2018-02-13T16:29:29.401868+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
2018-02-13T16:29:29.401886+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
2018-02-13T16:29:29.401905+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `load_interlock'
2018-02-13T16:29:29.401922+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:357:in `require_or_load'
2018-02-13T16:29:29.401940+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:335:in `depend_on'
2018-02-13T16:29:29.401958+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:251:in `require_dependency'
2018-02-13T16:29:29.401999+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
2018-02-13T16:29:29.402017+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:475:in `each'
2018-02-13T16:29:29.402170+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:475:in `block in eager_load!'
2018-02-13T16:29:29.402188+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:473:in `each'
2018-02-13T16:29:29.402206+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:473:in `eager_load!'
2018-02-13T16:29:29.402223+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:354:in `eager_load!'
2018-02-13T16:29:29.402240+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:67:in `each'
2018-02-13T16:29:29.402258+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:67:in `block in <module:Finisher>'
2018-02-13T16:29:29.402276+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
2018-02-13T16:29:29.402293+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
2018-02-13T16:29:29.402334+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
2018-02-13T16:29:29.402352+00:00 app[web.1]:    from /app/vendor/ruby-2.3.6/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
2018-02-13T16:29:29.402369+00:00 app[web.1]:    from /app/vendor/ruby-2.3.6/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2018-02-13T16:29:29.402387+00:00 app[web.1]:    from /app/vendor/ruby-2.3.6/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
2018-02-13T16:29:29.402404+00:00 app[web.1]:    from /app/vendor/ruby-2.3.6/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
2018-02-13T16:29:29.402421+00:00 app[web.1]:    from /app/vendor/ruby-2.3.6/lib/ruby/2.3.0/tsort.rb:347:in `each'
2018-02-13T16:29:29.402439+00:00 app[web.1]:    from /app/vendor/ruby-2.3.6/lib/ruby/2.3.0/tsort.rb:347:in `call'
2018-02-13T16:29:29.402457+00:00 app[web.1]:    from /app/vendor/ruby-2.3.6/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
2018-02-13T16:29:29.402497+00:00 app[web.1]:    from /app/vendor/ruby-2.3.6/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
2018-02-13T16:29:29.402515+00:00 app[web.1]:    from /app/vendor/ruby-2.3.6/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
2018-02-13T16:29:29.402533+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
2018-02-13T16:29:29.402550+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
2018-02-13T16:29:29.402569+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2018-02-13T16:29:29.402590+00:00 app[web.1]:    from config.ru:3:in `require_relative'
2018-02-13T16:29:29.402608+00:00 app[web.1]:    from config.ru:3:in `block in <main>'
2018-02-13T16:29:29.402625+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `instance_eval'
2018-02-13T16:29:29.402666+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `initialize'
2018-02-13T16:29:29.402684+00:00 app[web.1]:    from config.ru:in `new'
2018-02-13T16:29:29.402702+00:00 app[web.1]:    from config.ru:in `<main>'
2018-02-13T16:29:29.402720+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `eval'
2018-02-13T16:29:29.402737+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `new_from_string'
2018-02-13T16:29:29.402754+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.4/lib/rack/builder.rb:40:in `parse_file'
2018-02-13T16:29:29.402772+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.4/lib/rack/server.rb:319:in `build_app_and_options_from_config'
2018-02-13T16:29:29.402789+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.4/lib/rack/server.rb:219:in `app'
2018-02-13T16:29:29.402830+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:24:in `app'
2018-02-13T16:29:29.402848+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.4/lib/rack/server.rb:354:in `wrapped_app'
2018-02-13T16:29:29.402866+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.4/lib/rack/server.rb:283:in `start'
2018-02-13T16:29:29.402883+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:44:in `start'
2018-02-13T16:29:29.402906+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:135:in `block in perform'
2018-02-13T16:29:29.402924+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
2018-02-13T16:29:29.402941+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
2018-02-13T16:29:29.402959+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
2018-02-13T16:29:29.402996+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
2018-02-13T16:29:29.403014+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
2018-02-13T16:29:29.403167+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
2018-02-13T16:29:29.403185+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
2018-02-13T16:29:29.403202+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
2018-02-13T16:29:29.403221+00:00 app[web.1]:    from bin/rails:9:in `require'
2018-02-13T16:29:29.403239+00:00 app[web.1]:    from bin/rails:9:in `<main>'
2018-02-13T16:29:29.425694+00:00 app[web.1]: => Booting Puma
2018-02-13T16:29:29.425698+00:00 app[web.1]: => Rails 5.1.4 application starting in production 
2018-02-13T16:29:29.425700+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-13T16:29:29.425701+00:00 app[web.1]: Exiting
2018-02-13T16:33:06.012895+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=omrails-gutoslv.herokuapp.com request_id=f4e7f529-ef4a-40fc-ad87-44e5a0486091 fwd="187.32.207.129" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:33:06.743810+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=omrails-gutoslv.herokuapp.com request_id=5df1e475-e507-4095-84ff-9ec80b553faf fwd="187.32.207.129" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:34:58.358587+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=omrails-gutoslv.herokuapp.com request_id=be7e3e6b-5228-4b86-97e0-8342e5bc5170 fwd="187.32.207.129" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:34:59.040317+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=omrails-gutoslv.herokuapp.com request_id=08308b3b-e2d5-46e7-9c49-3ae1578e1fd8 fwd="187.32.207.129" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:42:43.015852+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=omrails-gutoslv.herokuapp.com request_id=dae71a5a-382f-4796-a3c3-fae77ce24e98 fwd="106.201.169.177" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:42:44.400235+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=omrails-gutoslv.herokuapp.com request_id=64f7b47c-3570-4a65-8000-cd9babd08e49 fwd="106.201.169.177" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:42:51.832070+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=omrails-gutoslv.herokuapp.com request_id=d380ed94-419e-46c8-b5a9-87e070353205 fwd="76.14.9.11" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:42:51.969280+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=omrails-gutoslv.herokuapp.com request_id=daaafecf-af6d-451e-a2de-3ca2ea5780cf fwd="76.14.9.11" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:42:53.660496+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=omrails-gutoslv.herokuapp.com request_id=11ccd17e-3cad-4ce6-a6c1-c0162aa14d9a fwd="34.193.245.68" dyno= connect= service= status=503 bytes= protocol=https
2018-02-13T16:46:05.152712+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=HEAD path="/" host=omrails-gutoslv.herokuapp.com request_id=7f751cc8-6190-4e10-8da1-c841c4967d37 fwd="34.235.121.206" dyno= connect= service= status=503 bytes= protocol=https

pg gem在Gemfile上的组生成下声明,如此

group :production do
  gem 'pg'
end

1 个答案:

答案 0 :(得分:1)

过去几个月经常被问到这个问题。在这里查看我的答案:https://stackoverflow.com/a/48676606/3372172

您必须在gemfile中指定特定的pg版本。如果没有,您将使用最新的可用版本(1.0.0)。但是Rails仍然不支持这个版本。点击此处:https://github.com/rails/rails/issues/31673

Yous应该使用版本0.21

gem 'pg', '0.21'