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

can't convert nil into String

Open mattbeedle opened this issue 12 years ago • 3 comments

Hi,

I just added this but something seems to be going wrong in the callback after I authorise the app in evernote sandbox. Any ideas?

Started GET "/users/auth/evernote/callback?oauth_token=mattbeedle.13A06B664E5.687474703A2F2F67657468697265732E6465762F75736572732F617574682F657665726E6F74652F63616C6C6261636B.1AF9E1F3B624DB8F433893961563B803&oauth_verifier=58E0104ECDFDB9C91939DEDC1067DCA3" for 127.0.0.1 at 2012-09-27 09:52:39 +0200

TypeError (can't convert nil into String): thrift (0.8.0) lib/thrift/transport/http_client_transport.rb:47:in initialize' thrift (0.8.0) lib/thrift/transport/http_client_transport.rb:47:innew' thrift (0.8.0) lib/thrift/transport/http_client_transport.rb:47:in flush' thrift_client (0.8.2) lib/thrift_client/server.rb:87:inflush' thrift (0.8.0) lib/thrift/client.rb:41:in send_message' evernote (1.2.1) vendor/gen-rb/evernote/edam/user_store.rb:87:insend_getUser' evernote (1.2.1) vendor/gen-rb/evernote/edam/user_store.rb:82:in getUser' thrift_client (0.8.2) lib/thrift_client/abstract_thrift_client.rb:148:inhandled_proxy' thrift_client (0.8.2) lib/thrift_client/abstract_thrift_client.rb:51:in getUser' evernote (1.2.1) lib/evernote/client.rb:14:inmethod_missing' omniauth-evernote (1.1.0) lib/omniauth/strategies/evernote.rb:32:in raw_info' omniauth-evernote (1.1.0) lib/omniauth/strategies/evernote.rb:15:inblock in class:Evernote' omniauth (1.1.1) lib/omniauth/strategy.rb:102:in instance_eval' omniauth (1.1.1) lib/omniauth/strategy.rb:102:inblock in compile_stack' omniauth (1.1.1) lib/omniauth/strategy.rb:101:in each' omniauth (1.1.1) lib/omniauth/strategy.rb:101:ininject' omniauth (1.1.1) lib/omniauth/strategy.rb:101:in compile_stack' (eval):7:inuid_stack' omniauth (1.1.1) lib/omniauth/strategy.rb:311:in uid' omniauth (1.1.1) lib/omniauth/strategy.rb:327:inauth_hash' omniauth (1.1.1) lib/omniauth/strategy.rb:355:in callback_phase' omniauth-oauth (1.0.1) lib/omniauth/strategies/oauth.rb:58:incallback_phase' omniauth (1.1.1) lib/omniauth/strategy.rb:219:in callback_call' omniauth (1.1.1) lib/omniauth/strategy.rb:175:incall!' omniauth (1.1.1) lib/omniauth/strategy.rb:157:in call' warden (1.2.1) lib/warden/manager.rb:35:inblock in call' warden (1.2.1) lib/warden/manager.rb:34:in catch' warden (1.2.1) lib/warden/manager.rb:34:incall' actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in call' rack (1.4.1) lib/rack/etag.rb:23:incall' rack (1.4.1) lib/rack/conditionalget.rb:25:in call' actionpack (3.2.8) lib/action_dispatch/middleware/head.rb:14:incall' remotipart (1.0.2) lib/remotipart/middleware.rb:30:in call' actionpack (3.2.8) lib/action_dispatch/middleware/params_parser.rb:21:incall' actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:in call' rack (1.4.1) lib/rack/session/abstract/id.rb:205:incontext' rack (1.4.1) lib/rack/session/abstract/id.rb:200:in call' actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:incall' dragonfly (0.9.12) lib/dragonfly/cookie_monster.rb:9:in call' activerecord (3.2.8) lib/active_record/query_cache.rb:64:incall' activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in call' actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:inblock in call' activesupport (3.2.8) lib/active_support/callbacks.rb:405:in _run__788053494452111219__call__295962505587541732__callbacks' activesupport (3.2.8) lib/active_support/callbacks.rb:405:in__run_callback' activesupport (3.2.8) lib/active_support/callbacks.rb:385:in _run_call_callbacks' activesupport (3.2.8) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in call' actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:incall' actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in call' actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in call' railties (3.2.8) lib/rails/rack/logger.rb:26:incall_app' railties (3.2.8) lib/rails/rack/logger.rb:16:in call' actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:incall' rack (1.4.1) lib/rack/methodoverride.rb:21:in call' rack (1.4.1) lib/rack/runtime.rb:17:incall' activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.4.1) lib/rack/lock.rb:15:incall' actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in call' dragonfly (0.9.12) lib/dragonfly/middleware.rb:13:incall' rack-cache (1.2) lib/rack/cache/context.rb:136:in forward' rack-cache (1.2) lib/rack/cache/context.rb:245:infetch' rack-cache (1.2) lib/rack/cache/context.rb:185:in lookup' rack-cache (1.2) lib/rack/cache/context.rb:66:incall!' rack-cache (1.2) lib/rack/cache/context.rb:51:in call' railties (3.2.8) lib/rails/engine.rb:479:incall' railties (3.2.8) lib/rails/application.rb:223:in call' railties (3.2.8) lib/rails/railtie/configurable.rb:30:inmethod_missing'

mattbeedle avatar Sep 27 '12 07:09 mattbeedle

Currently I don't have much free time, but I'll try to check it out next week. If you figure out what's wrong please create PR.

szimek avatar Sep 27 '12 08:09 szimek

It's a bug in thrift 0.8.0. It's already fixed on their trunk branch, but I'm not really sure how to point bundler to it. It's at https://github.com/apache/thrift/tree/trunk/lib/rb

szimek avatar Sep 27 '12 21:09 szimek

The quick fix would be to add the following code e.g. to config/initializers/thrift.rb file:

require "thrift"

module Thrift
  class HTTPClientTransport
    def flush
      http = Net::HTTP.new @url.host, @url.port
      http.use_ssl = @url.scheme == "https"
      resp = http.post(@url.request_uri, @outbuf, @headers)
      data = resp.body
      @inbuf = StringIO.new data
      @outbuf = ""
    end
  end
end

This code is taken from https://github.com/apache/thrift/blob/trunk/lib/rb/lib/thrift/transport/http_client_transport.rb#L43-50. Let me know if it works for you. I'll add info about this fix for thrift 0.8.0 to the README file, or maybe release a new version of omniauth-evernote gem with this fix.

szimek avatar Sep 28 '12 13:09 szimek