简体   繁体   中英

Heroku: Rails app works locally but crashes on heroku

I am running a simple rails app (my first one) on heroku. It works fine locally but I have a generic Application Error when opening the app.

I've tried, per other answers, doing "heroku run" "rake db:migrate", "heroku restart", "rake assets:precompile", but no joy yet. Pretty much just shooting in the dark. Here are the logs below:

heroku logs
2015-11-16T14:00:06.387026+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
2015-11-16T14:00:06.387037+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
2015-11-16T14:00:06.387049+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
2015-11-16T14:00:06.387060+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
2015-11-16T14:00:06.387075+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
2015-11-16T14:00:06.387087+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
2015-11-16T14:00:06.387134+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
2015-11-16T14:00:06.387099+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
2015-11-16T14:00:06.387111+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2015-11-16T14:00:06.387123+00:00 app[web.1]:    from /app/config.ru:3:in `block in <main>'
2015-11-16T14:00:06.387146+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
2015-11-16T14:00:06.387158+00:00 app[web.1]:    from /app/config.ru:in `new'
2015-11-16T14:00:06.387169+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2015-11-16T14:00:06.387180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
2015-11-16T14:00:06.387191+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
2015-11-16T14:00:06.387203+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
2015-11-16T14:00:06.387214+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
2015-11-16T14:00:06.387226+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
2015-11-16T14:00:06.387237+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/server.rb:61:in `app'
2015-11-16T14:00:06.387248+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
2015-11-16T14:00:06.387282+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
2015-11-16T14:00:06.387259+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:272:in `start'
2015-11-16T14:00:06.387271+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/server.rb:80:in `start'
2015-11-16T14:00:06.387305+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-11-16T14:00:06.387293+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-11-16T14:00:06.387328+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
2015-11-16T14:00:06.387316+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-11-16T14:00:06.387340+00:00 app[web.1]:    from bin/rails:8:in `require'
2015-11-16T14:00:06.416507+00:00 app[web.1]: => Booting WEBrick
2015-11-16T14:00:06.387352+00:00 app[web.1]:    from bin/rails:8:in `<main>'
2015-11-16T14:00:06.416511+00:00 app[web.1]: => Rails 4.2.4 application starting in production on http://0.0.0.0:54745
2015-11-16T14:00:06.416512+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-11-16T14:00:06.416512+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-11-16T14:00:06.416513+00:00 app[web.1]: Exiting
2015-11-16T14:00:07.129751+00:00 heroku[web.1]: Process exited with status 1
2015-11-16T14:00:07.135043+00:00 heroku[web.1]: State changed from starting to crashed
2015-11-16T15:34:27.920753+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=stormy-waters-4052.herokuapp.com request_id=5684a616-18c1-44a0-b0c9-a3b470579241 fwd="24.130.202.163" dyno= connect= service= status=503 bytes=
2015-11-16T15:34:28.434450+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=stormy-waters-4052.herokuapp.com request_id=4766d407-3879-4291-9cff-dde2c6fa600d fwd="24.130.202.163" dyno= connect= service= status=503 bytes=
2015-11-16T15:36:15.025229+00:00 heroku[web.1]: State changed from crashed to starting
2015-11-16T15:36:16.958112+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 27168 -e production`
2015-11-16T15:36:21.960104+00:00 app[web.1]: /app/app/models/ability.rb:2:in `<class:Ability>': uninitialized constant Ability::CanCan (NameError)
2015-11-16T15:36:21.960133+00:00 app[web.1]:    from /app/app/models/ability.rb:1:in `<top (required)>'
2015-11-16T15:36:21.960134+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
2015-11-16T15:36:21.960135+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/engine.rb:471:in `each'
2015-11-16T15:36:21.960136+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/engine.rb:469:in `eager_load!'
2015-11-16T15:36:21.960135+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/engine.rb:471:in `block in eager_load!'
2015-11-16T15:36:21.960136+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/engine.rb:469:in `each'
2015-11-16T15:36:21.960137+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/engine.rb:346:in `eager_load!'
2015-11-16T15:36:21.960140+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
2015-11-16T15:36:21.960139+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/application/finisher.rb:56:in `each'
2015-11-16T15:36:21.960140+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
2015-11-16T15:36:21.960141+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
2015-11-16T15:36:21.960141+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
2015-11-16T15:36:21.960142+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
2015-11-16T15:36:21.960142+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
2015-11-16T15:36:21.960143+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
2015-11-16T15:36:21.960141+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
2015-11-16T15:36:21.960146+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
2015-11-16T15:36:21.960143+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
2015-11-16T15:36:21.960144+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
2015-11-16T15:36:21.960145+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
2015-11-16T15:36:21.960145+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2015-11-16T15:36:21.960149+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
2015-11-16T15:36:21.960175+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
2015-11-16T15:36:21.960144+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
2015-11-16T15:36:21.960145+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
2015-11-16T15:36:21.960146+00:00 app[web.1]:    from /app/config.ru:3:in `block in <main>'
2015-11-16T15:36:21.960195+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
2015-11-16T15:36:21.960148+00:00 app[web.1]:    from /app/config.ru:in `new'
2015-11-16T15:36:21.960148+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2015-11-16T15:36:21.960147+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
2015-11-16T15:36:21.960149+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
2015-11-16T15:36:21.960209+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-11-16T15:36:21.960208+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-11-16T15:36:21.960217+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-11-16T15:36:21.960198+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:272:in `start'
2015-11-16T15:36:21.960206+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/server.rb:80:in `start'
2015-11-16T15:36:21.960174+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
2015-11-16T15:36:21.960219+00:00 app[web.1]:    from bin/rails:8:in `require'
2015-11-16T15:36:21.960195+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/server.rb:61:in `app'
2015-11-16T15:36:21.960197+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
2015-11-16T15:36:21.960207+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
2015-11-16T15:36:21.984658+00:00 app[web.1]: => Rails 4.2.4 application starting in production on http://0.0.0.0:27168
2015-11-16T15:36:21.960217+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
2015-11-16T15:36:21.984655+00:00 app[web.1]: => Booting WEBrick
2015-11-16T15:36:21.960226+00:00 app[web.1]:    from bin/rails:8:in `<main>'
2015-11-16T15:36:21.984659+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-11-16T15:36:21.984660+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-11-16T15:36:21.984661+00:00 app[web.1]: Exiting
2015-11-16T15:36:22.732321+00:00 heroku[web.1]: Process exited with status 1
2015-11-16T15:36:22.724457+00:00 heroku[web.1]: State changed from starting to crashed
2015-11-16T15:36:22.725695+00:00 heroku[web.1]: State changed from crashed to starting
2015-11-16T15:36:24.423653+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 19625 -e production`
2015-11-16T15:36:40.334054+00:00 heroku[run.9935]: Awaiting client
2015-11-16T15:36:40.374975+00:00 heroku[run.9935]: Starting process with command `bundle exec rake db:migrate`
2015-11-16T15:36:40.637639+00:00 heroku[run.9935]: State changed from starting to up
2015-11-16T15:36:45.450010+00:00 heroku[run.9935]: Process exited with status 0
2015-11-16T15:36:45.465182+00:00 heroku[run.9935]: State changed from up to complete
2015-11-16T15:36:37.299404+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by timyip1@gmail.com
2015-11-16T15:38:42.257965+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=stormy-waters-4052.herokuapp.com request_id=fa8105d4-b55e-4f7d-a357-f86adfebbd3b fwd="24.130.202.163" dyno= connect= service= status=503 bytes=
2015-11-16T15:38:33.424916+00:00 heroku[web.1]: State changed from starting to down

Make sure cancan is not in a development block in your Gemfile, ie if it is like this:

group :development do
  gem "cancan"
end

move it out of there. Then bundle install , commit the Gemfile and Gemfile.lock and redeploy to heroku.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM