I am running into an error in utils.rb:333 when I process a job with delayed job that works perfectly when run synchronously. Basically what I am doing is making a get request in my code and when I do, I run into the error. This is the line of code that hits the error:
self.fb_friends = (JSON.parse self.fb_token.get('me/friends')).first[1] unless self.fb_friends
self is a ruby class and self.fb_token is created here
OAuth2::AccessToken.new client, fb_token_string
where client is the result of the call to OauthHelper::client and fb_token_string is a token string from facebook
here is my stack trace:
{You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.delete
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.3/lib/rack/utils.rb:333:in `delete'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.3/lib/rack/utils.rb:326:in `[]='\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/faraday-0.6.1/lib/faraday/utils.rb:28:in `[]='\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/faraday-0.6.1/lib/faraday/utils.rb:85:in `block in merge_headers'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/faraday-0.6.1/lib/faraday/utils.rb:84:in `each'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/faraday-0.6.1/lib/faraday/utils.rb:84:in `merge_headers'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/faraday-0.6.1/lib/faraday/request.rb:69:in `to_env_hash'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/faraday-0.6.1/lib/faraday/request.rb:87:in `run'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/faraday-0.6.1/lib/faraday/request.rb:28:in `run'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/faraday-0.6.1/lib/faraday/connection.rb:170:in `run_request'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/oauth2-0.4.1/lib/oauth2/client.rb:59:in `request'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/oauth2-0.4.1/lib/oauth2/access_token.rb:34:in `request'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/oauth2-0.4.1/lib/oauth2/access_token.rb:38:in `get'\n
/Users/myuseraccount/Sites/tutorcloud/app/models/facebook_session.rb:69:in `get_fb_likes'\n
/Users/myuseraccount/Sites/tutorcloud/app/models/facebook_session.rb:305:in `save_to_user_info'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/performable_method.rb:20:in `perform'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/backend/base.rb:87:in `invoke_job'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:120:in `block (2 levels) in run'\n
/Users/myuseraccount/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/timeout.rb:57:in `timeout'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:120:in `block in run'\n
/Users/myuseraccount/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:119:in `run'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:177:in `reserve_and_run_one_job'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:104:in `block in work_off'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:103:in `times'\n
/Users/myuseraccount/.rvm/gems/ru开发者_运维知识库by-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:103:in `work_off'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:78:in `block (2 levels) in start'\n
/Users/myuseraccount/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:77:in `block in start'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:74:in `loop'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/worker.rb:74:in `start'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/command.rb:104:in `run'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/command.rb:83:in `block in run_process'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons/application.rb:249:in `call'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons/application.rb:249:in `block in start_proc'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons/daemonize.rb:197:in `call'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons/daemonize.rb:197:in `call_as_daemon'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons/application.rb:253:in `start_proc'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons/application.rb:293:in `start'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons/controller.rb:70:in `run'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons.rb:195:in `block in run_proc'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons/cmdline.rb:109:in `call'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons/cmdline.rb:109:in `catch_exceptions'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.1.4/lib/daemons.rb:194:in `run_proc'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/command.rb:81:in `run_process'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/command.rb:75:in `block in daemonize'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/command.rb:73:in `times'\n
/Users/myuseraccount/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-2.1.4/lib/delayed/command.rb:73:in `daemonize'\n
script/delayed_job:5:in `<main>'
I encountered the same error
Try to update Oauth2 to 0.5.0 When i update Omniauth to 0.3.0.rc2 and Oauth to 0.5.0 - problem has been resolved
精彩评论