我已经将pg和rails_12factor gem添加到我的gemfile并尝试将我的应用程序推送到heroku但是网站只是说应用程序错误,我几周前能够成功地通过我认为是相同的步骤来做到这一点。我做了一个小测试应用程序只是为了重新创建这个错误,这是我尝试推送到heroku时的输出:
2018-02-07T16:22:53.750068+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=coolguygear.herokuapp.com request_id=12882767-fed0-4354-b265-1d06931b22eb fwd="100.14.28.68" dyno= connect= service= status=503 bytes= protocol=http
2018-02-07T16:25:18.468191+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=HEAD path="/" host=coolguygear.herokuapp.com request_id=09ea1016-ba0c-4d77-8a71-92cd0388874d fwd="34.229.222.142" dyno= connect= service= status=503 bytes= protocol=https
2018-02-07T16:27:22.000000+00:00 app[api]: Build started by user pagaley12@outlook.com
2018-02-07T16:27:43.618675+00:00 heroku[web.1]: State changed from crashed to starting
2018-02-07T16:27:43.286746+00:00 app[api]: Deploy 32766c38 by user pagaley12@outlook.com
2018-02-07T16:27:43.286746+00:00 app[api]: Release v11 created by user pagaley12@outlook.com
2018-02-07T16:27:22.000000+00:00 app[api]: Build succeeded
2018-02-07T16:27:47.302392+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 24230 -e production`
2018-02-07T16:27:52.402259+00:00 heroku[web.1]: Process exited with status 1
2018-02-07T16:27:52.283395+00:00 app[web.1]: => Booting Puma
2018-02-07T16:27:52.283421+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-07T16:27:52.283420+00:00 app[web.1]: => Rails 5.1.4 application starting in production
2018-02-07T16:27:52.283486+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-07T16:27:52.283509+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-07T16:27:52.283423+00:00 app[web.1]: Exiting
2018-02-07T16:27:52.283534+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-07T16:27:52.283527+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-07T16:27:52.283537+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-07T16:27:52.283536+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-07T16:27:52.283541+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-07T16:27:52.283544+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-07T16:27:52.283539+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-07T16:27:52.283542+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-07T16:27:52.283546+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-07T16:27:52.283552+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-07T16:27:52.283550+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-07T16:27:52.283555+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-07T16:27:52.283557+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-07T16:27:52.283553+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-07T16:27:52.283561+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-07T16:27:52.283562+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-07T16:27:52.283564+00:00 app[web.1]: from /app/app/models/application_record.rb:1:in `<top (required)>'
2018-02-07T16:27:52.283566+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-07T16:27:52.283570+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-07T16:27:52.283574+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-07T16:27:52.283572+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-07T16:27:52.283583+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-07T16:27:52.283577+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-07T16:27:52.283579+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-07T16:27:52.283587+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-07T16:27:52.283592+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-07T16:27:52.283590+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-07T16:27:52.283596+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-07T16:27:52.283599+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-07T16:27:52.283605+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-07T16:27:52.283603+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-07T16:27:52.283609+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-07T16:27:52.283628+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-07T16:27:52.283635+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-07T16:27:52.283630+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-07T16:27:52.283631+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-07T16:27:52.283633+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-07T16:27:52.283638+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-07T16:27:52.283637+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-07T16:27:52.283644+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-07T16:27:52.283645+00:00 app[web.1]: from /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
2018-02-07T16:27:52.283642+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-07T16:27:52.283647+00:00 app[web.1]: from /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2018-02-07T16:27:52.283649+00:00 app[web.1]: from /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
2018-02-07T16:27:52.283652+00:00 app[web.1]: from /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
2018-02-07T16:27:52.283654+00:00 app[web.1]: from /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each'
2018-02-07T16:27:52.283660+00:00 app[web.1]: from /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
2018-02-07T16:27:52.283663+00:00 app[web.1]: from /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
2018-02-07T16:27:52.283656+00:00 app[web.1]: from /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `call'
2018-02-07T16:27:52.283669+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-07T16:27:52.283661+00:00 app[web.1]: from /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
2018-02-07T16:27:52.283667+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-07T16:27:52.283672+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>'
2018-02-07T16:27:52.283682+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-07T16:27:52.283674+00:00 app[web.1]: from config.ru:3:in `require_relative'
2018-02-07T16:27:52.283688+00:00 app[web.1]: from config.ru:in `new'
2018-02-07T16:27:52.283678+00:00 app[web.1]: from config.ru:3:in `block in <main>'
2018-02-07T16:27:52.283695+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-07T16:27:52.283684+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-07T16:27:52.283691+00:00 app[web.1]: from config.ru:in `<main>'
2018-02-07T16:27:52.283741+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-07T16:27:52.283746+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-07T16:27:52.283737+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-07T16:27:52.283739+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-07T16:27:52.283748+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-07T16:27:52.283750+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-07T16:27:52.283752+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-07T16:27:52.283755+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-07T16:27:52.283763+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-07T16:27:52.283762+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-07T16:27:52.283837+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-07T16:27:52.283838+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-07T16:27:52.283767+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-07T16:27:52.283840+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-07T16:27:52.283849+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-07T16:27:52.283845+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-07T16:27:52.283847+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-07T16:27:52.283851+00:00 app[web.1]: from bin/rails:4:in `require'
2018-02-07T16:27:52.283852+00:00 app[web.1]: from bin/rails:4:in `<main>'
2018-02-07T16:27:52.418583+00:00 heroku[web.1]: State changed from starting to crashed
2018-02-07T16:27:55.488508+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=coolguygear.herokuapp.com request_id=1b71ed89-fe54-437d-b13d-082c848c328c fwd="100.14.28.68" dyno= connect= service= status=503 bytes= protocol=http
2018-02-07T16:27:55.831207+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=coolguygear.herokuapp.com request_id=cc0e8bf6-f754-4ba2-be25-4e924afe0b71 fwd="100.14.28.68" dyno= connect= service= status=503 bytes= protocol=http
2018-02-07T16:27:56.485232+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=coolguygear.herokuapp.com request_id=e2530067-459c-4fea-a62e-7029fef88952 fwd="100.14.28.68" dyno= connect= service= status=503 bytes= protocol=http
2018-02-07T16:27:56.568374+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=coolguygear.herokuapp.com request_id=4d909fee-121c-4086-9060-5abb0531f9bd fwd="100.14.28.68" dyno= connect= service= status=503 bytes= protocol=http
2018-02-07T16:27:57.266204+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=coolguygear.herokuapp.com request_id=77ba5529-63bd-4257-9ee1-106c3f34d353 fwd="100.14.28.68" dyno= connect= service= status=503 bytes= protocol=http
2018-02-07T16:27:57.348456+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=coolguygear.herokuapp.com request_id=b4846660-d494-47c2-982a-626635621b69 fwd="100.14.28.68" dyno= connect= service= status=503 bytes= protocol=http
继承Heroku Logs:
{{1}}
答案 0 :(得分:0)
您是否尝试过命令 heroku logs 来打印rails服务器的输出?您可能会发现对您遇到的问题有用的东西。
答案 1 :(得分:0)
您必须在gemfile中指定特定的pg版本。如果没有,您将使用最新的可用版本(1.0.0)。但是Rails仍然不支持这个版本。点击此处:https://github.com/rails/rails/issues/31673
Yous应该使用版本0.21
gem 'pg', '0.21'