omniauth-oauth icon indicating copy to clipboard operation
omniauth-oauth copied to clipboard

undefined method `delete' for nil:NilClass

Open efleming opened this issue 12 years ago • 8 comments

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"} }

efleming avatar Apr 27 '12 14:04 efleming

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

mrkcor avatar May 03 '12 10:05 mrkcor

I've been running into this as well

dbwest avatar Jun 05 '12 20:06 dbwest

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.

neilcauldwell avatar Jul 18 '12 17:07 neilcauldwell

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

krzkrzkrz avatar Feb 20 '13 02:02 krzkrzkrz

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

jeppeliisberg avatar Mar 19 '13 12:03 jeppeliisberg

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

hayesgm avatar Mar 20 '13 08:03 hayesgm

:+1:

Drakula2k avatar May 08 '15 08:05 Drakula2k

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

colmarius avatar Aug 06 '15 10:08 colmarius

Closing as stale

BobbyMcWho avatar Aug 27 '24 16:08 BobbyMcWho