Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with omniauth-oauth2 #401

Closed
JimW opened this issue Feb 10, 2017 · 22 comments
Closed

Issue with omniauth-oauth2 #401

JimW opened this issue Feb 10, 2017 · 22 comments
Labels

Comments

@JimW
Copy link

@JimW JimW commented Feb 10, 2017

"There was an error while trying to load the gem 'omniauth-oauth2'. (Bundler::GemRequireError)"
Gem Load Error is: private method warn' called for nil:NilClass Backtrace for gem load error is: ....../vendor/bundle/ruby/2.2.0/gems/hashie-3.5.2/lib/hashie/mash.rb:334:in log_built_in_message'

Locked hashie gem back to 3.5.1 and it fixed it.

@dblock
Copy link
Member

@dblock dblock commented Feb 10, 2017

I tried to reproduce this in #402, but wasn't successful.

Which versions of omniauth-oauth2 are you using? Is this in Rails?

@michaelherold
Copy link
Member

@michaelherold michaelherold commented Feb 10, 2017

Also, what version of Omniauth? The recent 1.4.1 version should fix this issue.

@matthewrudy
Copy link
Contributor

@matthewrudy matthewrudy commented Feb 10, 2017

@michaelherold I get the same with 1.4.1

rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'omniauth-facebook'.
Gem Load Error is: private method `warn' called for nil:NilClass
Backtrace for gem load error is:
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:334:in `log_built_in_message'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:139:in `custom_writer'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:207:in `block in deep_update'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:200:in `each_pair'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:200:in `deep_update'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:115:in `initialize'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-1.4.1/lib/omniauth/auth_hash.rb:24:in `new'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-1.4.1/lib/omniauth/auth_hash.rb:24:in `regular_writer'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:140:in `custom_writer'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:207:in `block in deep_update'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:200:in `each_pair'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:200:in `deep_update'
/home/rof/cache/bundler/ruby/2.4.0/gems/hashie-3.5.2/lib/hashie/mash.rb:115:in `initialize'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-1.4.1/lib/omniauth.rb:45:in `new'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-1.4.1/lib/omniauth.rb:45:in `defaults'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-1.4.1/lib/omniauth.rb:50:in `initialize'
/home/rof/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/singleton.rb:142:in `new'
/home/rof/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/singleton.rb:142:in `block in instance'
/home/rof/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/singleton.rb:140:in `synchronize'
/home/rof/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/singleton.rb:140:in `instance'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-1.4.1/lib/omniauth.rb:119:in `config'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-oauth2-1.4.0/lib/omniauth/strategies/oauth2.rb:127:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:293:in `require'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:293:in `block in require'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:259:in `load_dependency'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:293:in `require'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-facebook-4.0.0/lib/omniauth/strategies/facebook.rb:1:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:293:in `require'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:293:in `block in require'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:259:in `load_dependency'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:293:in `require'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-facebook-4.0.0/lib/omniauth/facebook.rb:2:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:293:in `require'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:293:in `block in require'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:259:in `load_dependency'
/home/rof/cache/bundler/ruby/2.4.0/bundler/gems/rails-4d9c591a91c3/activesupport/lib/active_support/dependencies.rb:293:in `require'
/home/rof/cache/bundler/ruby/2.4.0/gems/omniauth-facebook-4.0.0/lib/omniauth-facebook.rb:1:in `<top (required)>'
@JimW
Copy link
Author

@JimW JimW commented Feb 10, 2017

oauth2 (1.3.0)
  faraday (>= 0.8, < 0.11)
  jwt (~> 1.0)
  multi_json (~> 1.3)
  multi_xml (~> 0.5)
  rack (>= 1.2, < 3)
omniauth (1.4.1)
  hashie (>= 1.2, < 3.5.2)
  rack (>= 1.0, < 3)
omniauth-google-oauth2 (0.4.1)
  jwt (~> 1.5.2)
  multi_json (~> 1.3)
  omniauth (>= 1.1.1)
  omniauth-oauth2 (>= 1.3.1)
omniauth-oauth2 (1.3.1)
  oauth2 (~> 1.0)
  omniauth (~> 1.2)

This is Rails 4.2.7.1

@michaelherold
Copy link
Member

@michaelherold michaelherold commented Feb 10, 2017

@matthewrudy Are you in a Rails app or a plain old Rack app?

@michaelherold
Copy link
Member

@michaelherold michaelherold commented Feb 10, 2017

@JimW Can you try bumping up to 3.5.2 and see if the problem persists for you?

@matthewrudy
Copy link
Contributor

@matthewrudy matthewrudy commented Feb 10, 2017

@michaelherold it's rails 5.0.1 with a few extra bits for ruby 2.4.0 support

gem 'rails', '~> 5.0.0', github: 'rails/rails',
                         branch: '5-0-stable',
                         ref: '4d9c591a91c3' # January 2nd 2017
@matthewrudy
Copy link
Contributor

@matthewrudy matthewrudy commented Feb 10, 2017

@michaelherold the only omniauth configuration I have is via devise

config.omniauth :facebook, Settings.facebook.key, Settings.facebook.secret
@michaelherold
Copy link
Member

@michaelherold michaelherold commented Feb 10, 2017

Hmm ...

@matthewrudy Can you open a Rails console and see what Hashie.logger returns? Also, do you have an entry for Hashie in your Gemfile at all?

@matthewrudy
Copy link
Contributor

@matthewrudy matthewrudy commented Feb 10, 2017

@michaelherold this seems minimal enough to break it without any of my app code.

bundle exec irb
2.4.0 :001 > require 'rails/all'
re => true
2.4.0 :002 > require 'omniauth-facebook'
NoMethodError: private method `warn' called for nil:NilClass

update:

hashie is not in my gemfile

@JimW
Copy link
Author

@JimW JimW commented Feb 10, 2017

@michaelherold I had locked it manually to < 3.5.2 to get around the error. 3.5.2 caused the error that I reported.

@michaelherold
Copy link
Member

@michaelherold michaelherold commented Feb 10, 2017

@matthewrudy Thank you, I'll see what I can find with that.

@JimW Gotcha, sorry about that.

@matthewrudy
Copy link
Contributor

@matthewrudy matthewrudy commented Feb 10, 2017

@michaelherold I think simply at that time in the boot cycle ::Rails is defined, but there is no Rails.logger assigned

So I think log_built_in_message needs to just deal with a nil logger
https://github.com/intridea/hashie/blob/a5906620a3cdff499aea556da6eefdf0de8e5138/lib/hashie/mash.rb#L334

@matthewrudy
Copy link
Contributor

@matthewrudy matthewrudy commented Feb 10, 2017

@michaelherold or, probably better

register a rails initializer that sets the logger on boot
rather than detecting ::Rails

@michaelherold
Copy link
Member

@michaelherold michaelherold commented Feb 10, 2017

That's definitely it. Nice debugging!

@matthewrudy
Copy link
Contributor

@matthewrudy matthewrudy commented Feb 10, 2017

@michaelherold
Copy link
Member

@michaelherold michaelherold commented Feb 10, 2017

I'm trying to put something together but it sounds like you have a good handle on it. Would you be able to put together a PR with a Railtie that handles setting the logger?

@justinmalone
Copy link

@justinmalone justinmalone commented Feb 10, 2017

@matthewrudy @michaelherold , I appreciate you guys ripping through that, I have the same problem. Is there any chance you can give us a snippet and where to put it, Not sure how to implement your fix. Thanks.

@matthewrudy
Copy link
Contributor

@matthewrudy matthewrudy commented Feb 10, 2017

@michaelherold @justinmalone just working on it.

@dblock
Copy link
Member

@dblock dblock commented Feb 10, 2017

Please try to modify #402 to fail in the same way so that we can have a reliable test for the future.

@michaelherold
Copy link
Member

@michaelherold michaelherold commented Feb 10, 2017

I've got a failing test. I'll push it up.

@matthewrudy
Copy link
Contributor

@matthewrudy matthewrudy commented Feb 10, 2017

@michaelherold cool

I think my fix is good to go #403
hope it passes your test.

michaelherold added a commit that referenced this issue Feb 10, 2017
Fix #401 w/ integration spec for omniauth-oauth2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.