spree-contrib / spree_social

Building block for spree social networking features (provides authentication and account linkage)
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
213 stars 283 forks source link

In airbrake - RuntimeError: Could not find a valid mapping for path "/users/auth/facebook/callback" #130

Open railsfactory-raju opened 10 years ago

railsfactory-raju commented 10 years ago

Hi,

Recently I built spree application with spree-2.1 + Spree_auth_devise-2.1 + spree_social- 2.1.

My airbrake account showing the below information,

Error class :  RuntimeError
Error message
RuntimeError: Could not find a valid mapping for path "/users/auth/facebook/callback"

URL: http://www.myspree.com/users/auth/facebook/callback?code=AQAwIHbHyt2bhqnN8dX3bt2P7chPUChY4gkRIv2sTiJoGsvOfjcQIypMGZpp3rb8M3A5VZxyQJwjtHLPJdceBVedZgCvjB32v6SOioY7DrRj-NeuYmDPubCd4sN0kfiC2G4O3P_WIY2-8sqUZMGJ2lW0xLJdVb2I7jnOzIqjLBxwIfYcYsiwlNnK7wuw8iNs5q9g7Qn33UpuPeWYUJwUsIeNaADjiGurP3M78D1fMFv1txTpz5Zjp6iZpDkPNBCqDVnI8-37EwcTnCIF6To_xYNuYtDOQ1rWlCNokxFloyIIcSsQaf6cjb484rav-bT8EeA&state=4b36d09be73cbbbaf97c5300f01db30ea7d84b3e416df750

File : [GEM_ROOT]/gems/devise-3.0.3/lib/devise/mapping.rb:47
Parameters
{
  "code": "AQAwIHbHyt2bhqnN8dX3bt2P7chPUChY4gkRIv2sTiJoGsvOfjcQIypMGZpp3rb8M3A5VZxyQJwjtHLPJdceBVedZgCvjB32v6SOioY7DrRj-NeuYmDPubCd4sN0kfiC2G4O3P_WIY2-8sqUZMGJ2lW0xLJdVb2I7jnOzIqjLBxwIfYcYsiwlNnK7wuw8iNs5q9g7Qn33UpuPeWYUJwUsIeNaADjiGurP3M78D1fMFv1txTpz5Zjp6iZpDkPNBCqDVnI8-37EwcTnCIF6To_xYNuYtDOQ1rWlCNokxFloyIIcSsQaf6cjb484rav-bT8EeA",
  "state": "4b36d09be73cbbbaf97c5300f01db30ea7d84b3e416df750"
}

backtrace:

/gems/devise-3.0.3/lib/devise/mapping.rb:47 in "find_by_path!"

/gems/devise-3.0.3/lib/devise/omniauth.rb:17 in "block in <top (required)>"

/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:465 in "call"

/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:465 in "fail!"

/gems/omniauth-oauth2-1.1.1/lib/omniauth/strategies/oauth2.rb:79 in "rescue in callback_phase"

/gems/omniauth-oauth2-1.1.1/lib/omniauth/strategies/oauth2.rb:67 in "callback_phase"

/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:226 in "callback_call"

/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:182 in "call!"

/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:164 in "call"

/gems/warden-1.2.3/lib/warden/manager.rb:35 in "block in call"

/gems/warden-1.2.3/lib/warden/manager.rb:34 in "catch"

/gems/warden-1.2.3/lib/warden/manager.rb:34 in "call"

/gems/rack-1.5.2/lib/rack/etag.rb:23 in "call"

/gems/rack-1.5.2/lib/rack/conditionalget.rb:25 in "call"

/gems/rack-1.5.2/lib/rack/head.rb:11 in "call"

/gems/actionpack-4.0.0/lib/action_dispatch/middleware/params_parser.rb:27 in "call"

/gems/actionpack-4.0.0/lib/action_dispatch/middleware/flash.rb:241 in "call"

/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225 in "context"

/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220 in "call"

/gems/actionpack-4.0.0/lib/action_dispatch/middleware/cookies.rb:486 in "call"

/gems/activerecord-4.0.0/lib/active_record/query_cache.rb:36 in "call"

/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:626 in "call"

/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:29 in "block in call"

/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:373 in "_run__4372578479850108574__call__callbacks"

/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80 in "run_callbacks"

/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:27 in "call"

/gems/actionpack-4.0.0/lib/action_dispatch/middleware/remote_ip.rb:76 in "call"

/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:17 in "call"

/gems/actionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30 in "call"

/gems/railties-4.0.0/lib/rails/rack/logger.rb:38 in "call_app"

/gems/railties-4.0.0/lib/rails/rack/logger.rb:21 in "block in call"

/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67 in "block in tagged"

/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:25 in "tagged"

/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67 in "tagged"

/gems/railties-4.0.0/lib/rails/rack/logger.rb:21 in "call"

/gems/actionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21 in "call"

/gems/rack-1.5.2/lib/rack/methodoverride.rb:21 in "call"

/gems/rack-1.5.2/lib/rack/runtime.rb:17 in "call"

/gems/activesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83 in "call"

/gems/railties-4.0.0/lib/rails/engine.rb:511 in "call"

/gems/railties-4.0.0/lib/rails/application.rb:97 in "call"

/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30 in "method_missing"

/home/production/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.40/lib/phusion_passenger/rack/thread_handler_extension.rb:74 in "process_request"

/home/production/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.40/lib/phusion_passenger/request_handler/thread_handler.rb:141 in "accept_and_process_next_request"

/home/production/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.40/lib/phusion_passenger/request_handler/thread_handler.rb:109 in "main_loop"

/home/production/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.40/lib/phusion_passenger/request_handler.rb:448 in "block (3 levels) in start_threads"

I unable to reproduce that issue with facebook signin/up && normal login/signup from live site.

But found this error from airbrake.

What is the problem? Please share your idea.

radar commented 10 years ago

@railsfactory-raju I don't know what this problem could be. If it can't be reproduced in a new store, then it's pretty hard for us to track it down and fix it.

geofflane commented 10 years ago

I saw the same thing after I was messing around with using store_location to return the user to the last page after login. I had to explicitly exclude the callbacks from being stored so they weren't hit multiple times. Possibly what others are seeing?

The exclusion urls for store_location are hard coded and are not extensible, so Spree Extensions can't hook into them to protect themselves from that behavior.

j-mcnally commented 10 years ago

https://github.com/intridea/omniauth/issues/240 related?

j-mcnally commented 10 years ago

Steps to reproduce:

  1. Enable an OAuth integration, Any will work.
  2. Start to sign in
  3. Cancel the Auth process (Tested on facebook)
  4. 500 error with stack trace similar to OP
j-mcnally commented 10 years ago

Work arounds:

  1. Spree::SocialConfig[:path_prefix] = 'spree_user'
OmniAuth.config.on_failure = Proc.new do |env|
  env['devise.mapping'] = Devise.mappings[:spree_user]
  controller_name  = ActiveSupport::Inflector.camelize(env['devise.mapping'].controllers[:omniauth_callbacks])
  controller_klass = ActiveSupport::Inflector.constantize("#{controller_name}Controller")
  controller_klass.action(:failure).call(env)
end