undefined method `delete' for nil:NilClass #6

Open
efleming opened this Issue Apr 27, 2012 · 8 comments

Comments

Projects
None yet
9 participants
@efleming

I am getting an occasional issue (3 occurrences in about 500 attempts) when users try to authenticate with Twitter. I am trying to fix the issue but I am not yet knowledgable enough on the internal workings of OmniAuth and figured someone else may be able to fix it faster. Here is the stack trace, url params, and session info of one of the failed requests:

Stack Trace:
NilClass# (NoMethodError) "undefined method delete' for nil:NilClass" /app/vendor/bundle/ruby/1.9.1/gems/omniauth-oauth-1.0.1/lib/omniauth/strategies/oauth.rb:48:incallback_phase'
/app/vendor/bundle/ruby/1.9.1/gems/omniauth-1.1.0/lib/omniauth/strategy.rb:219:in callback_call' /app/vendor/bundle/ruby/1.9.1/gems/omniauth-1.1.0/lib/omniauth/strategy.rb:175:incall!'
/app/vendor/bundle/ruby/1.9.1/gems/omniauth-1.1.0/lib/omniauth/strategy.rb:157:in call' /app/vendor/bundle/ruby/1.9.1/gems/omniauth-1.1.0/lib/omniauth/strategy.rb:177:incall!'
/app/vendor/bundle/ruby/1.9.1/gems/omniauth-1.1.0/lib/omniauth/strategy.rb:157:in call' /app/vendor/bundle/ruby/1.9.1/gems/omniauth-1.1.0/lib/omniauth/builder.rb:48:incall'
/app/vendor/bundle/ruby/1.9.1/gems/exceptional-2.0.32/lib/exceptional/integration/rack_rails.rb:13:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/best_standards_support.rb:17:incall'
/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/etag.rb:23:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:incall'
/app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/head.rb:14:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/params_parser.rb:21:incall'
/app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/flash.rb:242:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:incontext'
/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/cookies.rb:338:incall'
/app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:28:in block in call' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in_run__622710885669741672__call__2802837077016637006__callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in __run_callback' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in_run_call_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in run_callbacks' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:27:incall'
/app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/remote_ip.rb:31:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:16:incall'
/app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/show_exceptions.rb:56:in call' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/logger.rb:26:incall_app'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/logger.rb:16:in call' /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/request_id.rb:22:incall'
/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:incall'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/cache/strategy/local_cache.rb:72:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:incall'
/app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/static.rb:62:in call' /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:inforward'
/app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in fetch' /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:inlookup'
/app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in call!' /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:incall'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:479:in call' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/application.rb:220:incall'
/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in call' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/log_tailer.rb:14:incall'
/app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:80:in block in pre_process' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:incatch'
/app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:in pre_process' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:53:inprocess'
/app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:38:in receive_data' /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:inrun_machine'
/app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in run' /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/backends/base.rb:61:instart'
/app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/server.rb:159:in start' /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:inrun'
/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:265:in start' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands/server.rb:70:instart'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:55:in block in <top (required)>' /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:intap'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'

URL Params:
{ "oauth_token" : "DkjTqzDRtHpgjhqkloVLo8I6MeikM3lgadO3Bd5W54", "oauth_verifier" : "ytZE5xpofiduRcnTvDwuRvKZNT4eG9WqbS2tcZ9qw8", }

Relevant Session Info:
"oauth" : { "linkedin" : { "callback_confirmed" : "true"} }

@mkremer

This comment has been minimized.

Show comment Hide comment
@mkremer

mkremer May 3, 2012

I have experienced the same issue and will offer a pull request fixing the problem shortly.

mkremer commented May 3, 2012

I have experienced the same issue and will offer a pull request fixing the problem shortly.

@dbwest

This comment has been minimized.

Show comment Hide comment
@dbwest

dbwest Jun 5, 2012

I've been running into this as well

dbwest commented Jun 5, 2012

I've been running into this as well

@neilcauldwell

This comment has been minimized.

Show comment Hide comment
@neilcauldwell

neilcauldwell Jul 18, 2012

This error is occurring on our app's hand-rolled Twitter authentication implementation using the OAuth gem. Replacing the existing OAuth/SessionsController setup with Omniauth (based on the RailsCasts episode implementation) hasn't fixed the problem. In the OAuth setup there's a line in Sessions#create that deletes the request_token and request_secret from the session[:oauth] hash:

request_token = ::OAuth::RequestToken.new(consumer, session[:oauth].delete(:request_token), session[:oauth].delete(:request_secret))

However, the session[:oauth] disappears every so often by the time the user returns from Twitter, and .delete is being called on nil. It only seems to happen with Firefox or Camino.

This error is occurring on our app's hand-rolled Twitter authentication implementation using the OAuth gem. Replacing the existing OAuth/SessionsController setup with Omniauth (based on the RailsCasts episode implementation) hasn't fixed the problem. In the OAuth setup there's a line in Sessions#create that deletes the request_token and request_secret from the session[:oauth] hash:

request_token = ::OAuth::RequestToken.new(consumer, session[:oauth].delete(:request_token), session[:oauth].delete(:request_secret))

However, the session[:oauth] disappears every so often by the time the user returns from Twitter, and .delete is being called on nil. It only seems to happen with Firefox or Camino.

@krzkrzkrz

This comment has been minimized.

Show comment Hide comment
@krzkrzkrz

krzkrzkrz Feb 20, 2013

I am also experiencing this issue. Anyone have a fix for this?

I am also experiencing this issue. Anyone have a fix for this?

@jeppeliisberg

This comment has been minimized.

Show comment Hide comment
@jeppeliisberg

jeppeliisberg Mar 19, 2013

Hi, I'm seeing exactly the same here - curious to know if anyone solved it?

Hi, I'm seeing exactly the same here - curious to know if anyone solved it?

@hayesgm

This comment has been minimized.

Show comment Hide comment
@hayesgm

hayesgm Mar 20, 2013

It looks like @mkremer fixed the issue (at least, the surface-level issue) with intridea#9, which has not been pulled into master for 11 months. It appears this library isn't being actively maintained.

hayesgm commented Mar 20, 2013

It looks like @mkremer fixed the issue (at least, the surface-level issue) with intridea#9, which has not been pulled into master for 11 months. It appears this library isn't being actively maintained.

@Drakula2k

This comment has been minimized.

Show comment Hide comment
@Drakula2k

Drakula2k May 8, 2015

👍

👍

@colmarius

This comment has been minimized.

Show comment Hide comment
@colmarius

colmarius Aug 6, 2015

Experienced this same issue. Any possible solution? Thanks for any help.

Experienced this same issue. Any possible solution? Thanks for any help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment