SSL error - unable to access properties of object with YT Gem

I am new to rails and ruby. I am trying develop a rails 4 app with the YT gem to display and youtube videos. I see the following error when I access Title in rails App.

"A request to YouTube API caused an unexpected server error: {} You can retry the same request manually by running: curl -X GET -H "content-length: 0" -H "user-agent: Yt::Request (gzip)" "https://www.googleapis.com/youtube/v3/videos?id=bx5BUbiIXFw&key=AIzaSyCy7EGFIu9gFaWOlRGswoCugEi_20hB3js&part=snippet""

I could manually access the details with the URL given.

I tried from rails console it shows the following error.

Video.new url: "https://www.youtube.com/watch?v=bx5BUbiIXFw"

irb(main):006:0> video.title

Yt::Errors::ServerError: {"request_curl":"curl -X GET -H \"content-length: 0\" -
H \"user-agent: Yt::Request (gzip)\" \"https://www.googleapis.com/youtube/v3/vid
eos?id=bx5BUbiIXFw\u0026key=AIzaSyCpLai69UE3yYSRZKnFrwKkNJ6OIP2SfSI\u0026part=sn
ippet\"","response_body":"#\u003cOpenSSL::SSL::SSLError: SSL_connect returned=1
errno=0 state=SSLv3 read server certificate B: certificate verify failed\u003e"}

I have updated the SSL certificates for windows. Using Rails v 4.1.8, ruby 2.1.8p440 (2015-12-16 revision 53160) [i386-mingw32]. FYI I am able to upload files AWS with out any issues not sure if that helps with SSL.

Hoping to come out of this frustration.

Answers


SSLv3 read server certificate B: certificate verify failed

This may be a TLS vs SSL issue. Ruby may be attempting to connect with SSLv3. SSLv3 is insecure.

What happens when you run the above curl command with the --sslv3 option or when you execute the following code with and without the :TLSv1_2 set?

  con = Net::HTTP.new(host, 443)
  con.use_ssl = true
  con.ssl_version = :TLSv1_2
  con.get path { |r| ... }

I had a quick look at the YT gems docs and I don't see a way to set any SSL options.


https://github.com/google/google-api-ruby-client/issues/253

I had a similar issue and upgraded to Ruby 2.3.0 using rvm and it worked fine

rvm install 2.3.0

However, other people have mentioned that they have a workaround by updating their cert file. From dblommesteijn:

System wide solution would be this (for Yosemite and Ruby 2.2.1):

Downloading this http://curl.haxx.se/ca/cacert.pem, and saving it replacing /usr/local/etc/openssl/cert.pem. 
Add export SSL_CERT_FILE=/usr/local/etc/openssl/cert.pem to your .bash_profile. 
All net::http will pickup on ENV['SSL_CERT_FILE'].

RVM and ruby seems to have an outdated CA cert.

Need Your Help

Write data to RTC spare ram in Linux

linux key ram real-time-clock

My plan is to store data anywhere on the system besides hard drives, and that data can remain there even if the system is powered off.

numpy array representation and formatting

arrays numpy string-formatting

I am working with some documentation and wish to portray an array of this form