ruby-on-railspaperclipgoogle-cloud-storagegoogle-cloud-endpointsfog

Excon::Error::Socket: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A (OpenSSL::SSL::SSLError)


I'm attempting to use fog-google to upload images to my google cloud storage. My code looks like this:

config.paperclip_defaults = {
  storage: :fog,
  fog_host: "https://#{ENV.fetch('GOOGLE_STORAGE_BUCKET')}.storage.googleapis.com",
  fog_credentials: {
      google_storage_access_key_id: ENV.fetch('GOOGLE_STORAGE_ID'),
      google_storage_secret_access_key: ENV.fetch('GOOGLE_STORAGE_SECRET'),
      provider: 'Google' },
  fog_directory: ENV.fetch('GOOGLE_STORAGE_BUCKET') }

However, I always get this error: Excon::Error::Socket: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A (OpenSSL::SSL::SSLError)

Seems like the connection is not established successfully.

Here is the error log:

C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/ssl_socket.rb:117:in `connect_nonblock'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/ssl_socket.rb:117:in `initialize'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/connection.rb:404:in `new'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/connection.rb:404:in `socket'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/connection.rb:101:in `request_call'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/middlewares/mock.rb:48:in `request_call'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/middlewares/instrumentor.rb:26:in `request_call'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/middlewares/base.rb:16:in `request_call'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/middlewares/base.rb:16:in `request_call'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/middlewares/base.rb:16:in `request_call'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/excon-0.59.0/lib/excon/connection.rb:250:in `request'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/fog-core-1.45.0/lib/fog/core/connection.rb:81:in `request'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/fog-xml-0.1.3/lib/fog/xml/connection.rb:9:in `request'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/fog-google-0.6.0/lib/fog/storage/google_xml/real.rb:103:in `request'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/fog-google-0.6.0/lib/fog/storage/google_xml/requests/head_object.rb:36:in `head_object'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/fog-google-0.6.0/lib/fog/storage/google_xml/models/files.rb:81:in `head'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/paperclip-5.1.0/lib/paperclip/storage/fog.rb:65:in `exists?'

Solution

  • It works when I switch from windows to Linux.