Skip to content

conflict between vcr webmock/fakeweb and omniauth openid #254

Closed
gingerlime opened this Issue Jan 10, 2013 · 6 comments

3 participants

@gingerlime

Not sure what's the best place to post this, but we've come across a strange issue when having the vcr gem installed with either fakeweb or webmock and trying to use openid authentication (omniauth openid with google)

The problem we're seeing is similar to the one described on http://stackoverflow.com/questions/5361612/ruby-openid-socket-not-set-while-performing-discovery

When switching to Typhoeus the problem seems to be resolved. We haven't tried the other stubbing libraries yet.

This is affecting tests (or if installed in development, also in development) that don't involve using VCR.

Just wanted to let you know in case someone else comes across a similar problem. I know fakeweb support is deprecated, but nevertheless thought this should reported, particularly since it also happens with webmock.

@myronmarston
VCR member

FakeWeb appears to no longer be maintained, so I've decided to deprecate VCR's FakeWeb support (it probably won't be removed for a while though--in 3.0 at the earliest).

I'd like to fix the bug with WebMock, though. Do you have a reproducible example?

@gingerlime

We're using omniauth with openid, together with devise so it looks like it's buried somewhere within the omniauth-openid gem. I'll try to see if we can maybe build a small sample rails app that reproduces it somehow (or some other way to trigger this condition directly).

@myronmarston
VCR member

That would be great. I don't use omniauth, openid, or devise so it would be very hard for me to try to come up with an example that triggers this bug.

@gingerlime

I hope I've managed to create a tiny gem that reproduces the problem. It's very rough, but should do the trick.

https://gist.github.com/4513317

If you remove require 'webmock' it seems to work, but once required it throws this error:

/root/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/ruby-openid-2.2.2/lib/openid/yadis/discovery.rb:79:in `rescue in discover': Failed to fetch identity URL https://www.google.com/accounts/o8/id : Error fetching https://www.go
ogle.com/accounts/o8/id: undefined method `io' for nil:NilClass (OpenID::DiscoveryFailure)
        from /root/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/ruby-openid-2.2.2/lib/openid/yadis/discovery.rb:76:in `discover'
        from /root/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/ruby-openid-2.2.2/lib/openid/consumer/discovery.rb:389:in `discover_yadis'
        from /root/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/ruby-openid-2.2.2/lib/openid/consumer/discovery.rb:485:in `discover_uri'
        from /root/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/ruby-openid-2.2.2/lib/openid/consumer/discovery.rb:494:in `discover'
        from /root/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/ruby-openid-2.2.2/lib/openid/consumer.rb:333:in `discover'
        from /root/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/ruby-openid-2.2.2/lib/openid/consumer/discovery_manager.rb:51:in `get_next_service'
        from /root/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/ruby-openid-2.2.2/lib/openid/consumer.rb:222:in `begin'
        from /var/local/xyz/lib/xyz.rb:9:in `<module:Xyz>'
        from /var/local/xyz/lib/xyz.rb:5:in `<top (required)>'
        from bla.rb:1:in `require'
        from bla.rb:1:in `<main>'

@jayshepherd

I have reproduced this with @gingerlime's gem. I may be over my head a bit trying to trace this back through WebMock, but I will see what I can find.

@myronmarston
VCR member

This is clearly a bug in WebMock, given that @gingerlime's very helpful gist repros it w/o VCR loaded. I opened bblimke/webmock#310 so it can be discussed there. Closing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.