google-drive-ruby icon indicating copy to clipboard operation
google-drive-ruby copied to clipboard

SSL Error while accessing the GoogleDrive API

Open ksolvesnutra opened this issue 2 years ago • 2 comments

We've been using GoogleDrive GEM for one of our features for a long time and everything was working perfectly fine but for a few days while accessing the GoogleDrive API, our system is getting some SSL errors i.e. "SSL_read: shutdown while in init".

We are using the following piece of code to insert the records into the Google Sheet.

session = GoogleDrive::Session.from_service_account_key("json_file") key = "google_sheet_key" worksheet = spreadsheet.worksheets.first worksheet.insert_rows(...)

And while inserting the records into the worksheet this is occurring.

Can you please help us in this regard? If you need any other info then please do let us know.

ksolvesnutra avatar Oct 03 '22 05:10 ksolvesnutra

I'm having a similar issue. I am using the Google Sheets API and my code works on my local machine, but on the deployed server I'm getting:

OpenSSL::PKey::RSAError (Neither PUB key nor PRIV key: no start line):

My local machine is running LibreSSL 2.8.3 while the ubuntu server is running OpenSSL 1.1.1f 31 Mar 2020 which I believe should be compatible.. ?

I can't figure this one out...

timjedrek avatar Feb 12 '23 04:02 timjedrek

I just ran into this issue and found a fix that worked for me.

It appears to be because it doesn't like the formatting of the "private_key" value, hinting that it can't find the start line. In my case, after the first -----\n.

It was b/c my private key contents were in my .env file in a single line, which upgrading the library apparently didn't like.

So I moved the config contents to a .json file at config/google_cloud_credentials.json and set my ENV["GOOGLE_CLOUD_CREDENTIALS"] from the single line credentails JSON string to: config/google_cloud_credentials.json.

I also ran into an additional issue when I mistakenly lost newlines (\n) in the private key format.

😅

mackermedia avatar Dec 13 '23 19:12 mackermedia