Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:dummy_action causes further exception #14

Closed
vanboom opened this issue Dec 15, 2015 · 3 comments
Closed

:dummy_action causes further exception #14

vanboom opened this issue Dec 15, 2015 · 3 comments

Comments

@vanboom
Copy link

vanboom commented Dec 15, 2015

I am trying to hook up rails_exception_handler for the first time...

Everything works great when an exception is handled when a user is logged in, but when a user is not logged, I am getting an Incomplete response received from application exception.

Architecture:
Rails 4, Devise, CanCan

Steps to reproduce:

  1. Log out of the application.
  2. Browse to http://localhost:3000/images/test.png

I think the logic to try to go through :dummy_action to get the current user is causing this...

App 7947 stderr: [ 2015-12-14 18:16:03.6012 7996/0x0000000148b678(Worker 1) utils.rb:87 ]: *** Exception ArgumentError in Rack application object (uncaught throw :warden) (process 7996, thread 0x0000000148b678(Worker 1)):
[ 2015-12-14 18:16:03.6013 7886/7faef99a0700 age/Cor/Req/Utils.cpp:96 ]: [Client 3-1] Sending 502 response: application did not send a complete response
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/warden-1.2.3/lib/warden/proxy.rb:128:in `throw'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/warden-1.2.3/lib/warden/proxy.rb:128:in `authenticate!'
App 7947 stderr:    from /home/doug/.bundler/ruby/2.1.0/devise-5badce5e8e51/lib/devise/controllers/helpers.rb:112:in `authenticate_user!'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:424:in `block in make_lambda'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:160:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:160:in `block in halting'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:229:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:229:in `block in halting'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:229:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:229:in `block in halting'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:166:in `block in halting'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:86:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/callbacks.rb:86:in `run_callbacks'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/abstract_controller/callbacks.rb:19:in `process_action'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/action_controller/metal/rescue.rb:29:in `process_action'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/notifications.rb:159:in `block in instrument'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/notifications.rb:159:in `instrument'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/abstract_controller/base.rb:136:in `process'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionview-4.1.8/lib/action_view/rendering.rb:30:in `process'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/rails_exception_handler-2.3.4/lib/rails_exception_handler/handler.rb:17:in `initialize'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/rails_exception_handler-2.3.4/lib/patch/show_exceptions.rb:7:in `new'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/rails_exception_handler-2.3.4/lib/patch/show_exceptions.rb:7:in `render_exception_with_template'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/show_exceptions.rb:35:in `rescue in call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/rack/logger.rb:38:in `call_app'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/rack/logger.rb:20:in `block in call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/tagged_logging.rb:68:in `block in tagged'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/tagged_logging.rb:26:in `tagged'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/tagged_logging.rb:68:in `tagged'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/rack/logger.rb:20:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/quiet_assets-1.0.3/lib/quiet_assets.rb:23:in `call_with_quiet_assets'
App 7947 stderr:    from /home/doug/.bundler/ruby/2.1.0/quiet_safari-b091dff4f94c/lib/quiet_safari.rb:22:in `call_with_quiet_safari'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/methodoverride.rb:21:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/runtime.rb:17:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/lock.rb:17:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/static.rb:84:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/sendfile.rb:112:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/engine.rb:514:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/railties-4.1.8/lib/rails/application.rb:144:in `call'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/passenger-5.0.21/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/passenger-5.0.21/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/passenger-5.0.21/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/passenger-5.0.21/src/ruby_supportlib/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
App 7947 stderr:    from /var/lib/gems/2.1.0/gems/passenger-5.0.21/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'

Thanks for any help you could provide in tracking this down. The offending URL should show the user a 404 error page, instead of "Incomplete response received from application".
Thanks!

@vanboom
Copy link
Author

vanboom commented Dec 15, 2015

ErrorResponseController.send(:skip_before_filter, :authenticate_user!, :only=>[:index, :dummy_action])

This solved the issue! Leaving this issue open, as it might be worth updating the readme.

@bjorntrondsen
Copy link
Owner

Hi
Im glad you figured it out!

There's a wiki page for how to deal with authorization mechanisms
https://github.com/Sharagoz/rails_exception_handler/wiki/Interaction-with-authorization-mechanisms

Im not sure if the CanCan stuff is up to date because I use Pundit myself thee days.

Im linking to the wiki page from the readme but perhaps I need to make it clearer somehow if you didnt see it.

@bjorntrondsen
Copy link
Owner

I've adjust the readme to explicitly refer to CanCan, Pundit etc. when talking about authorization gems. That should make it easier for the next person.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants