Tomelower
Tomelower

Reputation: 495

Heroku Rails "Application Error"

Although my app is running with no errors locally I am getting a crash in production mode on Heroku.

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'm vey new at all of this and I can not make enough sense of the logs to figure out how to resolve this. Can anyone help me cypher through this and find the problem?

2014-07-03T18:46:43.305889+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
2014-07-03T18:46:43.305944+00:00 app[web.1]:    from /app/config.ru:in `new'
2014-07-03T18:46:43.305937+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
2014-07-03T18:46:43.305954+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
2014-07-03T18:46:43.305929+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
2014-07-03T18:46:43.305939+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
2014-07-03T18:46:43.305788+00:00 app[web.1]: => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
2014-07-03T18:46:43.305934+00:00 app[web.1]:    from /app/config.ru:3:in `block in <main>'
2014-07-03T18:46:43.305922+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2014-07-03T18:46:43.306000+00:00 app[web.1]:    from bin/rails:8:in `<main>'
2014-07-03T18:46:43.305963+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
2014-07-03T18:46:43.305945+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2014-07-03T18:46:43.305950+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
2014-07-03T18:46:43.305933+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-
4.1.1/lib/active_support/dependencies.rb:247:in `require'
2014-07-03T18:46:43.305832+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
2014-07-03T18:46:43.305992+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `server'
2014-07-03T18:46:43.305955+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
2014-07-03T18:46:43.305960+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/server.rb:50:in `app'
2014-07-03T18:46:43.305949+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
2014-07-03T18:46:43.305987+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:81:in `block in server'
2014-07-03T18:46:43.305958+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
2014-07-03T18:46:43.305989+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `tap'
2014-07-03T18:46:43.305965+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:250:in `start'
2014-07-03T18:46:43.305985+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/server.rb:69:in `start'
2014-07-03T18:46:43.305998+00:00 app[web.1]:    from bin/rails:8:in `require'
2014-07-03T18:46:43.305994+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
2014-07-03T18:46:43.305995+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
2014-07-03T18:46:44.787130+00:00 heroku[web.1]: Process exited with status 1
2014-07-03T18:46:45.301324+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/singles/edit/4" host=bergescreative.herokuapp.com request_id=727f16f2-4d68-4a60-ac85-3a8e13b2b0bb fwd="24.189.33.4" dyno= connect= service= status=503 bytes=
2014-07-03T18:46:44.807228+00:00 heroku[web.1]: State changed from starting to crashed
2014-07-03T18:49:15+00:00 heroku[slug-compiler]: Slug compilation started
2014-07-03T18:49:42+00:00 heroku[slug-compiler]: Slug compilation finished
2014-07-03T18:49:42.205650+00:00 heroku[web.1]: State changed from crashed to starting
2014-07-03T18:49:42.010780+00:00 heroku[api]: Deploy abeb632 by [email protected]
2014-07-03T18:49:42.010853+00:00 heroku[api]: Release v46 created by [email protected]
2014-07-03T18:49:47.637148+00:00 app[web.1]: => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
2014-07-03T18:49:47.637183+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:468:in `block (2 levels) in eager_load!'
2014-07-03T18:49:47.637163+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
2014-07-03T18:49:47.637195+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:346:in `eager_load!'
2014-07-03T18:49:47.637159+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
2014-07-03T18:49:47.637209+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
2014-07-03T18:49:47.637251+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
2014-07-03T18:49:47.637146+00:00 app[web.1]: => Run `rails server -h` for more startup options
2014-07-03T18:49:47.637164+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:348:in `require_or_load'
2014-07-03T18:49:47.637202+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `instance_exec'
2014-07-03T18:49:47.637144+00:00 app[web.1]: => Rails 4.1.1 application starting in production on http://0.0.0.0:48908
2014-07-03T18:49:47.637181+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:225:in `require_dependency'
2014-07-03T18:49:47.637198+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/application/finisher.rb:58:in `block in <module:Finisher>'
2014-07-03T18:49:47.637322+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
2014-07-03T18:49:47.637149+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-07-03T18:49:47.637184+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:467:in `each'
2014-07-03T18:49:47.637206+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
2014-07-03T18:49:47.637259+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
2014-07-03T18:49:47.637265+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2014-07-03T18:49:47.637272+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
2014-07-03T18:49:47.637274+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
2014-07-03T18:49:47.637285+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
2014-07-03T18:49:47.637151+00:00 app[web.1]: Exiting
2014-07-03T18:49:47.637188+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:467:in `block in eager_load!'
2014-07-03T18:49:47.637211+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
2014-07-03T18:49:47.637261+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
2014-07-03T18:49:47.637267+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
2014-07-03T18:49:47.637276+00:00 app[web.1]:    from /app/config.ru:3:in `block in <main>'
2014-07-03T18:49:47.637296+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
2014-07-03T18:49:47.637330+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2014-07-03T18:49:47.637158+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require': /app/app/controllers/links_controller.rb:34: syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError)
2014-07-03T18:49:47.637190+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:465:in `each'
2014-07-03T18:49:47.637249+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
2014-07-03T18:49:47.637262+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:54:in `run_initializers'
2014-07-03T18:49:47.637269+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
2014-07-03T18:49:47.637293+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
2014-07-03T18:49:47.637325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
2014-07-03T18:49:47.637161+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
2014-07-03T18:49:47.637192+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:465:in
 `eager_load!'
2014-07-03T18:49:47.637245+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
2014-07-03T18:49:47.637127+00:00 app[web.1]: => Booting WEBrick
2014-07-03T18:49:47.637168+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:307:in `depend_on'
2014-07-03T18:49:47.637197+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/application/finisher.rb:58:in `each'
2014-07-03T18:49:47.637256+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
2014-07-03T18:49:47.637279+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
2014-07-03T18:49:47.637280+00:00 app[web.1]:    from /app/config.ru:in `new'
2014-07-03T18:49:47.637283+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2014-07-03T18:49:47.637287+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
2014-07-03T18:49:47.637288+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
2014-07-03T18:49:47.637290+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
2014-07-03T18:49:47.637295+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/server.rb:50:in `app'
2014-07-03T18:49:47.637297+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:250:in `start'
2014-07-03T18:49:47.637314+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/server.rb:69:in `start'
2014-07-03T18:49:47.637203+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `run'
2014-07-03T18:49:47.637258+00:00 app[web.1]:    from /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
2014-07-03T18:49:47.637264+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/application.rb:288:in `initialize!'
2014-07-03T18:49:47.637277+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
2014-07-03T18:49:47.637315+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:81:in `block in server'
2014-07-03T18:49:47.637327+00:00 app[web.1]:    from bin/rails:4:in `require'
2014-07-03T18:49:47.637320+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `server'
2014-07-03T18:49:47.637319+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `tap'
2014-07-03T18:49:45.168372+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 48908 -e production`
2014-07-03T18:49:49.013452+00:00 heroku[web.1]: Process exited with status 1
2014-07-03T18:49:49.021141+00:00 heroku[web.1]: State changed from starting to crashed
2014-07-03T18:49:51.064834+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/singles/edit/4" host=bergescreative.herokuapp.com request_id=e722a08a-0cc9-460b-9bf8-28d678f04fd4 fwd="24.189.33.4" dyno= connect= service= status=503 bytes=
2014-07-03T18:51:50.750302+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/singles/edit/4" host=bergescreative.herokuapp.com request_id=55d17389-9d17-4a4f-bf32-a8594973e3e0 fwd="24.189.33.4" dyno= connect= service= status=503 bytes=

Upvotes: 1

Views: 389

Answers (2)

Richard Peck
Richard Peck

Reputation: 76774

Server

Firstly, you'll want to migrate away from WEBrick, and use something like unicorn or puma as your production server:

#Procfile
web: bundle exec puma -t ${PUMA_MIN_THREADS:-8}:${PUMA_MAX_THREADS:-12} -w ${PUMA_WORKERS:-2} -p $PORT -e ${RACK_ENV:-production}

#Gemfile
group :production do
    gem 'puma'
end

WEBrick is very slow, and takes a lot of time to process every resource individually. You'll be much better using a more "production-friendly" server on Heroku


Error

As mentioned, your error is here:

/app/app/controllers/links_controller.rb:34: syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError)

The typical case of keyword_end errors is the inability of the Rails application to parse the controller, as it's not got an end to the particular method in question.

The solution will be to check links_controller.rb at line 34 (or around it), to determine where there is a syntax issue, then you can do:

$ git add .
$ git commit -a -m "Links Controller Error"
$ git push heroku master  

Upvotes: 1

emerak
emerak

Reputation: 274

Check this controller /app/app/controllers/links_controller.rb:34: syntax error, unexpected keyword_end, expecting end-of-input (SyntaxError), you are probable missing an end

Upvotes: 3

Related Questions