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

NoMethodError occurred in omniauth_callbacks#facebook #115

Open jackkinsella opened 10 years ago

jackkinsella commented 10 years ago

Receiving a sporadic exception (one per 30-50 Facebook authentications) in production using the Spree 2-0-stable stack.

URL: /users/auth/facebook/callback?code=CODE
BACKTRACE:
A NoMethodError occurred in omniauth_callbacks#facebook:

undefined method `user' for nil:NilClass
vendor/bundle/ruby/1.9.1/bundler/gems/spree_social-    3b9139eaf8f9/app/controllers/spree/omniauth_callbacks_controller.rb:42:in `facebook'

SESSION (leaving in only the keys that had values)


    data: {"_csrf_token"=>
    "access_token"=> ,
    "order_id"=> ,
    "spree_user_return_to"=>"/checkout/payment",
    "omniauth"=>
     {"provider"=>"facebook",
      "uid"=>,
      "info"=>
       {"nickname"=> 
        "name"=>
        "first_name"=>
        "last_name"=>
        "image"=>
        "description"=>
        "location"=>
        "verified"=>true},
      "credentials"=>
       {"token"=>
       ,
        "expires_at"=>,
        "expires"=>true}},
     "_turbolinks_redirect_to"=>
      "/user/spree_user/sign_up"}
radar commented 10 years ago

Hi @jackkinsella,

This may be an issue when a user has a current order only, since that's where the stacktrace is pointing. We don't have a test for that at the moment in spree_social... could you try your hand at writing a regression test for this issue?

jackkinsella commented 10 years ago

I took 15 minutes this morning but I couldn't even figure out where to start. With my deadlines crunching I have to pass on this one.

radar commented 10 years ago

@jackkinsella Have you been able to figure this one out yet?