1

I started learning ruby on rails last week and now I am to the point of deploying my first app via heroku. It seems to deploy successfully but when I launch the URL I get an error that says, "Application Error: An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details."

I've looked through the logs I can't find an error, but I've new to programming and I don't really know what I'm looking for. I don't know if you guys help people with stuff like this, but I'm completely lost at this point.

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=
max
  • 96,212
  • 14
  • 104
  • 165
fredabood
  • 11
  • 1
  • are you able to fire up a console? ```heroku run console``` – laertiades Sep 07 '15 at 16:26
  • Looks like you're trying to use paperclip - look at this - http://stackoverflow.com/questions/6002414/undefined-method-has-attached-file-with-paperclip-2-3-8-gem-for-rails-2-using – Anthony Sep 07 '15 at 16:37
  • Edited, I replaced your email address with an `@example.com` address because spambots – max Sep 07 '15 at 16:39
  • Please post the log for your $git heroku push. It looks like the app was not deployed successfully to begin with, so when you launch it crashes. The fact that it's attempting to run with WEBrick (in the log you posted) is a red flag. Heroku does not run WEBrick. So you have some config issues. If you haven't already, I highly recommend you go through all these steps: https://devcenter.heroku.com/articles/getting-started-with-rails4#heroku-gems. – Elvn Sep 07 '15 at 16:42
  • Make sure your app runs fine locally. – abhishek77in Sep 07 '15 at 18:12
  • Also whenever I run a heroku command I have to explicitly specify the app I want. So if i would normally use the command "heroku run rake routes db:migrate" I have to use "heroku run rake routes db:migrate -a myappname" instead. I don't know if this is related or not. – fredabood Sep 07 '15 at 19:53
  • This is the tutorial I'm using. https://www.udemy.com/the-startups-guide-to-web-development-with-ruby-on-rails/learn/#/lecture/793932 – fredabood Sep 07 '15 at 19:55
  • I am able to fire up console and it runs fine locally. – fredabood Sep 07 '15 at 19:56

2 Answers2

0

Did you run migration after pushing the code to heroku?

heroku run rake db:migrate 
Mush
  • 75
  • 2
  • 9
0

Add this gem gem 'rails_12factor', group: :production into your gem file, run The bundle command push the code and when you run again heroku logs you Will see that the logs have more information. It will help you find the error

xeitor
  • 368
  • 4
  • 15