【问题标题】:I'm having a Heroku deployment error and can't decipher the logs to find my issue我遇到 Heroku 部署错误,无法破译日志以找到我的问题
【发布时间】:2015-12-03 05:51:32
【问题描述】:

我上周开始在 Rails 上学习 ruby​​,现在我可以通过 heroku 部署我的第一个应用程序。它似乎部署成功,但是当我启动 URL 时,我收到一条错误消息:“应用程序错误:应用程序中发生错误,无法提供您的页面。请稍后再试。如果您是应用程序所有者,请查看您的日志以了解详细信息。”

我查看了日志,但没有发现错误,但我是编程新手,我真的不知道我在寻找什么。我不知道你们是否帮助过这样的人,但我现在完全迷失了。

2015-09-07T15:50:05.024049+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
2015-09-07T15:50:05.024052+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
2015-09-07T15:50:05.024058+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:61:in `app'
2015-09-07T15:50:05.024061+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
2015-09-07T15:50:05.024064+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:272:in `start'
2015-09-07T15:50:05.024055+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
2015-09-07T15:50:05.024056+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
2015-09-07T15:50:05.024071+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-09-07T15:50:05.024076+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-09-07T15:50:05.024074+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-09-07T15:50:05.024066+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:80:in `start'
2015-09-07T15:50:05.024068+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
2015-09-07T15:50:05.024082+00:00 app[web.1]:    from bin/rails:8:in `require'
2015-09-07T15:50:05.024079+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
2015-09-07T15:50:05.024146+00:00 app[web.1]:    from bin/rails:8:in `<main>'
2015-09-07T15:50:06.046079+00:00 heroku[web.1]: Process exited with status 1
2015-09-07T15:50:06.066413+00:00 heroku[web.1]: State changed from starting to crashed
2015-09-07T15:50:24.438832+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by fredabood@example.com
2015-09-07T15:50:28.651252+00:00 heroku[run.9094]: Awaiting client
2015-09-07T15:50:28.706348+00:00 heroku[run.9094]: Starting process with command `bundle exec rake db:migrate`
2015-09-07T15:50:28.784167+00:00 heroku[run.9094]: State changed from starting to up
2015-09-07T15:50:34.378618+00:00 heroku[run.9094]: State changed from up to complete
2015-09-07T15:50:34.362482+00:00 heroku[run.9094]: Process exited with status 1
2015-09-07T15:51:28.977594+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by fredabood@example.com
2015-09-07T15:51:32.886462+00:00 heroku[run.9234]: Awaiting client
2015-09-07T15:51:32.919387+00:00 heroku[run.9234]: Starting process with command `bundle exec rake db:migrate`
2015-09-07T15:51:33.223465+00:00 heroku[run.9234]: State changed from starting to up
2015-09-07T15:51:37.273592+00:00 heroku[run.9234]: State changed from up to complete
2015-09-07T15:51:37.260913+00:00 heroku[run.9234]: Process exited with status 1
2015-09-07T15:51:59.068384+00:00 heroku[api]: Starting process with command `bundle exec rake db:create` by fredabood@example.com
2015-09-07T15:52:02.487432+00:00 heroku[run.7049]: Awaiting client
2015-09-07T15:52:02.537394+00:00 heroku[run.7049]: Starting process with command `bundle exec rake db:create`
2015-09-07T15:52:02.827404+00:00 heroku[run.7049]: State changed from starting to up
2015-09-07T15:52:06.137302+00:00 heroku[run.7049]: State changed from up to complete
2015-09-07T15:52:06.122419+00:00 heroku[run.7049]: Process exited with status 0
2015-09-07T15:52:22.424544+00:00 heroku[web.1]: State changed from crashed to starting
2015-09-07T15:52:26.863901+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 47010 -e production`
2015-09-07T15:52:31.630975+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `has_attached_file' for Listing (call 'Listing.connection' to establish a connection):Class (NoMethodError)
2015-09-07T15:52:31.632005+00:00 app[web.1]:    from /app/app/models/listing.rb:1:in `<top (required)>'
2015-09-07T15:52:31.631099+00:00 app[web.1]:    from /app/app/models/listing.rb:2:in `<class:Listing>'
2015-09-07T15:52:31.632070+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
2015-09-07T15:52:31.632050+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
2015-09-07T15:52:31.632029+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
2015-09-07T15:52:31.632142+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:317:in `depend_on'
2015-09-07T15:52:31.632089+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
2015-09-07T15:52:31.632108+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:360:in `require_or_load'
2015-09-07T15:52:31.632162+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:233:in `require_dependency'
2015-09-07T15:52:31.632181+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
2015-09-07T15:52:31.632199+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:471:in `each'
2015-09-07T15:52:31.632219+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:471:in `block in eager_load!'
2015-09-07T15:52:31.632237+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:469:in `each'
2015-09-07T15:52:31.632256+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:469:in `eager_load!'
2015-09-07T15:52:31.632275+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:346:in `eager_load!'
2015-09-07T15:52:31.632295+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application/finisher.rb:56:in `each'
2015-09-07T15:52:31.632321+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
2015-09-07T15:52:31.629027+00:00 app[web.1]: => Booting WEBrick
2015-09-07T15:52:31.632360+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
2015-09-07T15:52:31.632341+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
2015-09-07T15:52:31.629052+00:00 app[web.1]: => Rails 4.2.4 application starting in production on http://0.0.0.0:47010
2015-09-07T15:52:31.632379+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
2015-09-07T15:52:31.632397+00:00 app[web.1]:    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
2015-09-07T15:52:31.629055+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-09-07T15:52:31.632416+00:00 app[web.1]:    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
2015-09-07T15:52:31.629056+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-09-07T15:52:31.632435+00:00 app[web.1]:    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
2015-09-07T15:52:31.632473+00:00 app[web.1]:    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
2015-09-07T15:52:31.632454+00:00 app[web.1]:    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
2015-09-07T15:52:31.632510+00:00 app[web.1]:    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
2015-09-07T15:52:31.632492+00:00 app[web.1]:    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
2015-09-07T15:52:31.632547+00:00 app[web.1]:    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
2015-09-07T15:52:31.630598+00:00 app[web.1]: Exiting
2015-09-07T15:52:31.632529+00:00 app[web.1]:    from /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
2015-09-07T15:52:31.632566+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
2015-09-07T15:52:31.632605+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2015-09-07T15:52:31.632585+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
2015-09-07T15:52:31.632624+00:00 app[web.1]:    from /app/config.ru:3:in `require'
2015-09-07T15:52:31.632643+00:00 app[web.1]:    from /app/config.ru:3:in `block in <main>'
2015-09-07T15:52:31.632669+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
2015-09-07T15:52:31.632708+00:00 app[web.1]:    from /app/config.ru:in `new'
2015-09-07T15:52:31.632688+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
2015-09-07T15:52:31.632727+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2015-09-07T15:52:31.632764+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
2015-09-07T15:52:31.632746+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
2015-09-07T15:52:31.632783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
2015-09-07T15:52:31.633293+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
2015-09-07T15:52:31.632802+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
2015-09-07T15:52:31.633269+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:61:in `app'
2015-09-07T15:52:31.632820+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
2015-09-07T15:52:31.633313+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:272:in `start'
2015-09-07T15:52:31.633332+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:80:in `start'
2015-09-07T15:52:31.633369+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-09-07T15:52:31.633351+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
2015-09-07T15:52:31.633388+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-09-07T15:52:31.633407+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-09-07T15:52:31.633446+00:00 app[web.1]:    from bin/rails:8:in `require'
2015-09-07T15:52:31.633465+00:00 app[web.1]:    from bin/rails:8:in `<main>'
2015-09-07T15:52:31.633426+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
2015-09-07T15:52:32.744378+00:00 heroku[web.1]: Process exited with status 1
2015-09-07T15:52:32.764415+00:00 heroku[web.1]: State changed from starting to crashed
2015-09-07T15:52:33.212738+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fredit.herokuapp.com request_id=2b79e612-df3c-4894-8bb2-352f519d7a24 fwd="73.161.236.115" dyno= connect= service= status=503 bytes=
2015-09-07T15:52:34.498611+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fredit.herokuapp.com request_id=c4793969-7b8e-4aa7-945f-3f6f852c1b0b fwd="73.161.236.115" dyno= connect= service= status=503 bytes=

【问题讨论】:

  • 你能启动控制台吗? heroku run console
  • 看起来你正在尝试使用回形针 - 看看这个 - stackoverflow.com/questions/6002414/…
  • 已编辑,我将您的电子邮件地址替换为 @example.com 地址,因为垃圾邮件机器人
  • 请为您的 $git heroku 推送发布日志。看起来该应用程序一开始没有成功部署,所以当您启动它时它会崩溃。它试图与 WEBrick 一起运行(在您发布的日志中)的事实是一个危险信号。 Heroku 不运行 WEBrick。所以你有一些配置问题。如果您还没有,我强烈建议您完成所有这些步骤:devcenter.heroku.com/articles/…
  • 确保您的应用在本地运行良好。

标签: ruby-on-rails ruby ruby-on-rails-4 heroku heroku-toolbelt


【解决方案1】:

你在将代码推送到 Heroku 后是否运行了迁移?

heroku run rake db:migrate 

【讨论】:

  • 是的,我做到了。评论有最小字符限制,这很愚蠢。
【解决方案2】:

将此 gem gem 'rails_12factor', group: :production 添加到您的 gem 文件中,运行 bundle 命令推送代码,当您再次运行 heroku logs 时,您将看到日志中有更多信息。它将帮助您找到错误

【讨论】:

    猜你喜欢
    • 2012-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-13
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    相关资源
    最近更新 更多