Gem Dependency Woes: Faraday and Tumblr Client

Well there goes the better part of my Saturday.</p>

I’ve been working on a project lately that heavily leans on Mumblr, a gem I wrote that will fetch your content from Tumblr, cache it locally in MongoDB, and keep things up to date. (It’s pretty awesome — in fact, all the content on petercompernolle.com is managed via Tumblr using tags and a handful of private posts.)

A few days ago, I started getting 500 errors, and nearly all of my Mumblr tests were failing with the same error:

NoMethodError: undefined method `client=' for #<Faraday::ConnectionOptions:0x00000101c295c8>
~/.rvm/gems/ruby-2.0.0-p451/gems/faraday-0.9.0/lib/faraday/options.rb:31:in `block in update'
~/.rvm/gems/ruby-2.0.0-p451/gems/faraday-0.9.0/lib/faraday/options.rb:20:in `each'
~/.rvm/gems/ruby-2.0.0-p451/gems/faraday-0.9.0/lib/faraday/options.rb:20:in `update'
~/.rvm/gems/ruby-2.0.0-p451/gems/faraday-0.9.0/lib/faraday/options.rb:52:in `merge'
~/.rvm/gems/ruby-2.0.0-p451/gems/faraday-0.9.0/lib/faraday.rb:69:in `new'

I immediately checked the tumblr_client github repo, as well as the faraday repo, which appeared to be causing the error. No updates for a few months. Hmm.

I dug into the gem itself, and found that Faraday was making a send call when setting options without checking that self.respond_to?("#{key}="). To make sure I wasn’t being an idiot, I made a few changes, and kept getting farther, and that certainly was the issue: like the message said, Faraday::ConnectionOptions doesn’t respond to client=. Okay, great. So now what?

I updated Ruby, assuming my outdatedness came to bite me in the ass. But wait — my other sites are having the issue too, and one of them uses a newer version of Ruby (2.1.0). So back to digging.

The answer was frustratingly obvious. tumblr_client recently changed their dependency on Faraday, and so I can only assume I ran a bundle update without realizing the issue.

So, I:

Uninstalled faraday 0.9.0:

gem uninstall faraday --version 0.9.0

Added it 0.8.0 to my Gemfile:

gem 'faraday', '0.8.0'
gem 'mumblr', github: 'thelowlypeon/mumblr'

And manually installed it to make sure:

gem install faraday --version 0.8.0

And now we’re all good. Sigh. I wish I had my hours back.

#gem #dependency #tumblr

← Return