ruby-on-rails - 我们很抱歉,但有些不对劲。如果您是应用程序所有者,请查看日志以获取更多信息

标签 ruby-on-rails logging heroku terminal

在本地主机上,我的项目运行完美,但每次我部署到 heroku 时,我都会收到出错的消息......我还运行了 Heroku run rake db:migrate。知道这里发生了什么吗?

2015-11-01T23:27:52.203020+00:00 app[web.1]:    bin/rails:8:in `require'
2015-11-01T23:27:52.203020+00:00 app[web.1]:    bin/rails:8:in `<main>'
2015-11-01T23:27:52.203072+00:00 app[web.1]: [2015-11-01 23:27:52] INFO  going to shutdown ...
2015-11-01T23:27:52.203127+00:00 app[web.1]: Exiting
2015-11-01T23:27:52.532296+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 41390 -e production`
2015-11-01T23:27:52.897623+00:00 heroku[web.1]: Process exited with status 143
2015-11-01T23:27:58.070739+00:00 app[web.1]: [2015-11-01 23:27:58] INFO  WEBrick 1.3.1
2015-11-01T23:27:58.070767+00:00 app[web.1]: [2015-11-01 23:27:58] INFO  ruby 2.2.1 (2015-02-26) [x86_64-linux]
2015-11-01T23:27:58.071119+00:00 app[web.1]: [2015-11-01 23:27:58] INFO  WEBrick::HTTPServer#start: pid=3 port=41390
2015-11-01T23:27:58.474379+00:00 heroku[web.1]: State changed from starting to up
2015-11-01T23:27:59.642521+00:00 app[web.1]: => Booting WEBrick
2015-11-01T23:27:59.642524+00:00 app[web.1]: => Rails 4.2.4 application starting in production on http://0.0.0.0:41390
2015-11-01T23:27:59.642526+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-11-01T23:27:59.642527+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-11-01T23:27:59.642527+00:00 app[web.1]: Started GET "/" for 186.7.194.9 at 2015-11-01 23:27:59 +0000
2015-11-01T23:27:59.766836+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-11-01T23:27:59.799012+00:00 app[web.1]:   Listing Load (2.1ms)  SELECT "listings".* FROM "listings"
2015-11-01T23:28:00.392668+00:00 heroku[router]: at=info method=GET path="/" host=first-2015.herokuapp.com request_id=926437db-f38c-4e20-bd41-214c5a3c23e4 fwd="186.7.194.9" dyno=web.1 connect=1ms service=776ms status=500 bytes=1754
2015-11-01T23:28:00.357900+00:00 app[web.1]: Completed 500 Internal Server Error in 591ms (ActiveRecord: 43.1ms)
2015-11-01T23:28:00.357305+00:00 app[web.1]:   Rendered listings/index.html.erb within layouts/application (561.8ms)
2015-11-01T23:28:00.379967+00:00 app[web.1]: 
2015-11-01T23:28:00.379972+00:00 app[web.1]: ActionView::Template::Error (Path '/original/1_maxresdefault.jpg' not found):
2015-11-01T23:28:00.379974+00:00 app[web.1]:     3: <% @listings.each do |listing| %>
2015-11-01T23:28:00.379975+00:00 app[web.1]:     4:   <div class="col-md-3">
2015-11-01T23:28:00.379975+00:00 app[web.1]:     5:     <div class="thumbnail">
2015-11-01T23:28:00.379976+00:00 app[web.1]:     6:       <%= image_tag listing.image.url %>
2015-11-01T23:28:00.379976+00:00 app[web.1]:     7:       <div class="caption">
2015-11-01T23:28:00.379977+00:00 app[web.1]:     8:         <h3><%= listing.name %></h3>
2015-11-01T23:28:00.379978+00:00 app[web.1]:     9:         <p><%= number_to_currency(listing.price)%></p>
2015-11-01T23:28:00.379979+00:00 app[web.1]:   app/views/listings/index.html.erb:6:in `block in _app_views_listings_index_html_erb___3544290808032810079_70137168564260'
2015-11-01T23:28:00.379980+00:00 app[web.1]:   app/views/listings/index.html.erb:3:in `_app_views_listings_index_html_erb___3544290808032810079_70137168564260'
2015-11-01T23:28:00.379980+00:00 app[web.1]: 
2015-11-01T23:28:00.379981+00:00 app[web.1]: 
2015-11-01T23:28:35.183269+00:00 heroku[web.1]: State changed from up to starting
2015-11-01T23:28:37.475572+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 45138 -e production`
2015-11-01T23:28:39.679694+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-11-01T23:28:41.150522+00:00 app[web.1]: [2015-11-01 23:28:41] FATAL SignalException: SIGTERM
2015-11-01T23:28:41.150526+00:00 app[web.1]:    /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:174:in `select'
2015-11-01T23:28:41.150528+00:00 app[web.1]:    /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:174:in `block in start'
2015-11-01T23:28:41.150529+00:00 app[web.1]:    /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:32:in `start'
2015-11-01T23:28:41.150530+00:00 app[web.1]:    /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:162:in `start'
2015-11-01T23:28:41.150530+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:34:in `run'
2015-11-01T23:28:41.150531+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
2015-11-01T23:28:41.150532+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:80:in `start'
2015-11-01T23:28:41.150533+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
2015-11-01T23:28:41.150534+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-11-01T23:28:41.150535+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-11-01T23:28:41.150535+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-11-01T23:28:41.150536+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
2015-11-01T23:28:41.150537+00:00 app[web.1]:    bin/rails:8:in `require'
2015-11-01T23:28:41.150538+00:00 app[web.1]:    bin/rails:8:in `<main>'
2015-11-01T23:28:41.150616+00:00 app[web.1]: [2015-11-01 23:28:41] INFO  going to shutdown ...
2015-11-01T23:28:41.150667+00:00 app[web.1]: [2015-11-01 23:28:41] INFO  WEBrick::HTTPServer#start done.
2015-11-01T23:28:41.150693+00:00 app[web.1]: Exiting
2015-11-01T23:28:42.127027+00:00 heroku[web.1]: Process exited with status 143
2015-11-01T23:28:42.240828+00:00 app[web.1]: [2015-11-01 23:28:42] INFO  WEBrick 1.3.1
2015-11-01T23:28:42.240888+00:00 app[web.1]: [2015-11-01 23:28:42] INFO  ruby 2.2.1 (2015-02-26) [x86_64-linux]
2015-11-01T23:28:42.241276+00:00 app[web.1]: [2015-11-01 23:28:42] INFO  WEBrick::HTTPServer#start: pid=3 port=45138
2015-11-01T23:28:42.749478+00:00 heroku[web.1]: State changed from starting to up
2015-11-01T23:28:43.792876+00:00 app[web.1]: => Booting WEBrick
2015-11-01T23:28:43.792882+00:00 app[web.1]: => Rails 4.2.4 application starting in production on http://0.0.0.0:45138
2015-11-01T23:28:43.792883+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-11-01T23:28:43.792884+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-11-01T23:28:43.792884+00:00 app[web.1]: Started GET "/" for 186.7.194.9 at 2015-11-01 23:28:43 +0000
2015-11-01T23:28:43.852744+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-11-01T23:28:43.871140+00:00 app[web.1]:   Listing Load (1.8ms)  SELECT "listings".* FROM "listings"
2015-11-01T23:28:44.290320+00:00 heroku[router]: at=info method=GET path="/" host=first-2015.herokuapp.com request_id=801454af-a367-44c0-813d-11682425132c fwd="186.7.194.9" dyno=web.1 connect=1ms service=503ms status=500 bytes=1754
2015-11-01T23:28:44.289069+00:00 app[web.1]:   Rendered listings/index.html.erb within layouts/application (421.4ms)
2015-11-01T23:28:44.290295+00:00 app[web.1]: 
2015-11-01T23:28:44.289266+00:00 app[web.1]: Completed 500 Internal Server Error in 436ms (ActiveRecord: 9.3ms)
2015-11-01T23:28:44.290297+00:00 app[web.1]: ActionView::Template::Error (Path '/original/1_maxresdefault.jpg' not found):
2015-11-01T23:28:44.290299+00:00 app[web.1]:     4:   <div class="col-md-3">
2015-11-01T23:28:44.290299+00:00 app[web.1]:     3: <% @listings.each do |listing| %>
2015-11-01T23:28:44.290301+00:00 app[web.1]:     6:       <%= image_tag listing.image.url %>
2015-11-01T23:28:44.290300+00:00 app[web.1]:     5:     <div class="thumbnail">
2015-11-01T23:28:44.290302+00:00 app[web.1]:     8:         <h3><%= listing.name %></h3>
2015-11-01T23:28:44.290303+00:00 app[web.1]:     9:         <p><%= number_to_currency(listing.price)%></p>
2015-11-01T23:28:44.290302+00:00 app[web.1]:     7:       <div class="caption">
2015-11-01T23:28:44.290305+00:00 app[web.1]:   app/views/listings/index.html.erb:3:in `_app_views_listings_index_html_erb__2061699741869559202_69894874271620'
2015-11-01T23:28:44.290304+00:00 app[web.1]:   app/views/listings/index.html.erb:6:in `block in _app_views_listings_index_html_erb__2061699741869559202_69894874271620'
2015-11-01T23:28:44.290306+00:00 app[web.1]: 
2015-11-01T23:28:44.290306+00:00 app[web.1]: 
2015-11-01T23:35:20.887734+00:00 app[web.1]: Started GET "/" for 186.7.194.9 at 2015-11-01 23:35:20 +0000
2015-11-01T23:35:20.894377+00:00 app[web.1]:   Listing Load (1.7ms)  SELECT "listings".* FROM "listings"
2015-11-01T23:35:20.890439+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-11-01T23:35:21.264843+00:00 heroku[router]: at=info method=GET path="/" host=first-2015.herokuapp.com request_id=7c3a22ea-957b-49f6-83d5-6d639dae83f2 fwd="186.7.194.9" dyno=web.1 connect=0ms service=380ms status=500 bytes=1754
2015-11-01T23:35:21.258765+00:00 app[web.1]:   Rendered listings/index.html.erb within layouts/application (366.5ms)
2015-11-01T23:35:21.263640+00:00 app[web.1]: 
2015-11-01T23:35:21.263643+00:00 app[web.1]: ActionView::Template::Error (Path '/original/1_maxresdefault.jpg' not found):
2015-11-01T23:35:21.263644+00:00 app[web.1]:     3: <% @listings.each do |listing| %>
2015-11-01T23:35:21.263645+00:00 app[web.1]:     4:   <div class="col-md-3">
2015-11-01T23:35:21.263646+00:00 app[web.1]:     5:     <div class="thumbnail">
2015-11-01T23:35:21.263646+00:00 app[web.1]:     6:       <%= image_tag listing.image.url %>
2015-11-01T23:35:21.263647+00:00 app[web.1]:     7:       <div class="caption">
2015-11-01T23:35:21.263648+00:00 app[web.1]:     8:         <h3><%= listing.name %></h3>
2015-11-01T23:35:21.263649+00:00 app[web.1]:     9:         <p><%= number_to_currency(listing.price)%></p>
2015-11-01T23:35:21.263651+00:00 app[web.1]:   app/views/listings/index.html.erb:3:in `_app_views_listings_index_html_erb__2061699741869559202_69894874271620'
2015-11-01T23:35:21.263650+00:00 app[web.1]:   app/views/listings/index.html.erb:6:in `block in _app_views_listings_index_html_erb__2061699741869559202_69894874271620'
2015-11-01T23:35:21.263651+00:00 app[web.1]: 
2015-11-01T23:35:21.263652+00:00 app[web.1]: 
2015-11-01T23:35:21.261958+00:00 app[web.1]: Completed 500 Internal Server Error in 371ms (ActiveRecord: 1.7ms)

最佳答案

这是你的错误:

ActionView::Template::Error (Path '/original/1_maxresdefault.jpg' not found):
2015-11-01T23:28:00.379974+00:00 app[web.1]:     3: <% @listings.each do |listing| %>
2015-11-01T23:28:00.379975+00:00 app[web.1]:     4:   <div class="col-md-3">
2015-11-01T23:28:00.379975+00:00 app[web.1]:     5:     <div class="thumbnail">
2015-11-01T23:28:00.379976+00:00 app[web.1]:     6:       <%= image_tag listing.image.url %>

问题似乎是您的 listing.image.url 的路径未被识别。

我不确定为什么 Rails 将此视为 fatal error (通常,它只会显示带有“未找到”图像的 HTML img),但在这种情况下,它会导致整个 Rails 应用程序失败。


解决方法(使此工作正常)是删除 <%= image_tag listing.image.url %> 来自您的 app/views/listings/index.html.erb文件。

这不是解决方法,但应该可以解决眼前的问题。


修复 有两个方面(我不完全确定问题的原因是什么):

  1. Ensure your Paperclip files are intact
  2. Ensure your DB has the correct references

问题似乎是 /original/1_maxresdefault.jpg不存在。

YouTube 使用此图片名称,因此我怀疑您是在翻 Youtube 封面图片还是试图模仿 YouTube 的视频处理结构。

无论哪种方式,您的应用中的文件夹结构应该如下所示:

public/system/[model]/[attachment]/[other_options]/[sizes]/[file].[extension]

在我看来,您的路径没有被正确调用,或者您的文件名不正确。您可能已经手动填充了文件名或其他内容。

我会亲自删除整个 /public/system文件夹(它是 Paperclips'),删除数据库中对附件的所有引用并浏览我所有的 listings上传新图像。

然后我会确保 public/system存在于 git push 中(您可以通过检查它不在 .gitignore 中来确保这一点),然后再次推送到 Heroku。

-

还要确保 Heroku 的数据库结构模仿您的开发环境 - 生产 数据库中引用的图像可能不存在。

关于ruby-on-rails - 我们很抱歉,但有些不对劲。如果您是应用程序所有者,请查看日志以获取更多信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33490141/

相关文章:

ruby-on-rails - 使用 Docker 运行 rake 任务在 Rails4 中记录问题

ruby-on-rails - 在 Rails 中使用命名空间模型和 Controller 的问题

sql - 多表发票SUM比较

java - 在调试中运行 Logback

javascript - 错误!缺少脚本 : Start when deploying to heroku

go.mod Unresolved 依赖

ruby-on-rails - 实现一个Facebook样式的消息传递系统,其中用户可以位于另一个模型的两个不同列中的任意一个中

java - log4j 2 迁移桥 log4j-1.2-api.jar 缺少类

python-3.x - python 3.6 *记录模块错误* UnicodeEncodeError : 'charmap' codec can't encode characters

ruby - Sinatra - 通过 config.ru 设置缓存控制 header