【问题标题】:Using Unicorn on Rails 4.0 deploying to Heroku 504 error at "/"在“/”处使用 Unicorn on Rails 4.0 部署到 Heroku 504 错误
【发布时间】:2015-01-29 19:15:27
【问题描述】:

我正在尝试将我的应用程序部署到 heroku,但出现 504 错误,以及显示“应用程序错误”的应用程序页面 (vipp.heroku.com)。我的 rails 控制台内容如下:

config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:

  • 开发 - 将其设置为 false
  • test - 将其设置为 false(除非您使用预加载测试环境的工具)
  • 生产 - 将其设置为 true

/app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:191:in normalize_conditions!': You should not use thematchmethod in your router without specifying an HTTP method. (RuntimeError) If you want to expose your action to both GET and POST, addvia: [:get, :post]option. If you want to expose your action to GET, usegetin the router: Instead of: match "controller#action" Do: get "controller#action" from /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:67:ininitialize' 来自 /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in new' from /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:inadd_route' 来自 /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1417:in decomposed_match' from /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1398:inblock in match' 来自 /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in each' from /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:inmatch' 来自 /app/config/routes.rb:16:in block in <top (required)>' from /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:ininstance_exec' 来自 /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in eval_block' from /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:indraw' 来自 /app/config/routes.rb:1:in <top (required)>' from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:inload' 来自 /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in block in load' from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:inload_dependency' 来自 /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in load' from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:inblock in load_paths' 来自 /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in each' from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:inload_paths' 来自 /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in reload!' from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:102:inreload_routes! 来自 /app/vendor/bundle/ruby/2.0.0/gems/devise-3.2.0/lib/devise/rails.rb:14:in block in <class:Engine>' from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:36:incall' 来自 /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:36:in execute_hook' from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:45:inblock in run_load_hooks' 来自 /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:44:in each' from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:44:inrun_load_hooks' 来自 /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:55:in block in <module:Finisher>' from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:ininstance_exec' 来自 /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in run' from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:inblock in run_initializers' 来自 /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in block in tsort_each' from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:inblock (2 个级别) in each_strongly_connected_component' 来自 /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in each_strongly_connected_component_from' from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:inblock in each_strongly_connected_component' 来自 /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in each' from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:ineach_strongly_connected_component' 来自 /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in tsort_each' from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:inrun_initializers' 来自 /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in initialize!' from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:inmethod_missing' 来自 /app/config/environment.rb:5:in <top (required)>' from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:inrequire' 来自 /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in block in require' from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:inload_dependency' 来自 /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in require' from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:inrequire_environment! 来自 /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:63:in <top (required)>' from script/rails:6:inrequire' 来自 script/rails:6:in `'。

2015-01-29T18:44:55.600313+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=vipp.herokuapp.com request_id= b473ecd3-a78f-473e-a1b7-926adad9ebb6 fwd="35.2.143.28" dyno= connect= service= status=503 bytes=

【问题讨论】:

    标签: ruby-on-rails ruby heroku unicorn


    【解决方案1】:

    您的环境配置文件(development.rbproduction.rbtest.rb)似乎已损坏。 如果您发布这些内容,我们可以同时看到确切的问题 - 这是config.eager_load 的有效配置示例:

    生产.rb

    config.eager_load = true
    

    development.rb

    config.eager_load = false
    

    test.rb

    config.eager_load = false
    

    【讨论】:

      猜你喜欢
      • 2013-05-25
      • 2014-09-18
      • 1970-01-01
      • 1970-01-01
      • 2018-05-08
      • 2020-04-20
      • 2023-03-31
      • 2016-12-25
      • 2011-09-07
      相关资源
      最近更新 更多