Omniauth Facebook Error - Faraday::Error::ConnectionFailed

user1372829 picture user1372829 · May 27, 2012 · Viewed 22.4k times · Source

(FYI: I'm following the Twitter Omniauth from railscast #241. I used Twitter successfully, now going onto Facebook)

As soon as I logged into Facebook using Omniauth, I get this error:

Faraday::Error::ConnectionFailed
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

What does this mean?

This is my code

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, '<key from fb>', '<another key from fb>'
end

There's actually nothing much in my code, all I have is in the sessionController that I want to use to_yaml to see what's inside the request.env

class SessionsController < ApplicationController
    def create
        raise request.env["omniauth.auth"].to_yaml
    end
end

How do I solve the Faraday error?

Answer

Andrei Radulescu picture Andrei Radulescu · Jun 14, 2012

I've fixed this on Mac OS X Lion 10.7.4 with this solution:

$ rvm remove 1.9.3 (or whatever version of ruby you are using)
$ rvm pkg install openssl
$ rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr

after this you will need to download the missing cacert.pem file:

$ cd $rvm_path/usr/ssl
$ sudo curl -O http://curl.haxx.se/ca/cacert.pem
$ sudo mv cacert.pem cert.pem