Google-api-ruby-client: Google Drive v2 insert_file causes timeout?

Created on 15 Feb 2016  路  5Comments  路  Source: googleapis/google-api-ruby-client

Hi guys,

I'm trying to upload a file to Google drive -- It's a 400MB file.

Google::Apis::TransmissionError: execution expired
from /Users/jponc/.rbenv/versions/2.1.6/lib/ruby/2.1.0/openssl/buffering.rb:326:in `syswrite'

I'm encountering this error and I got stuck from there. I tried a couple of things like changing uploadType to reusable, but no luck

triage me

Most helpful comment

@webzorg Not the easiest to read, but try https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/ClientOptions#open_timeout_sec-instance_method

I ended up using:

service.client_options.send_timeout_sec = 1200
service.client_options.open_timeout_sec = 1200

Where, service = Google::Apis::SheetsV4::SheetsService.new

All 5 comments

metadata = GoogleDrive::File.new(title: attachment.file_name, mime_type: attachment.file_type, parents: [folder_file])
drive.insert_file(metadata, upload_source: local_file_location.to_s, content_type: attachment.file_type)

Here's a gist of my insert_file related code

screenshot 2016-02-15 22 34 19

This is basically the screencap of the error I encountered.

GoogleDrive::DriveService.new.tap do |client|
  client.request_options.timeout_sec = 1200
  client.request_options.open_timeout_sec = 1200
  client.request_options.retries = 3
end

Kudos to my friend https://github.com/sylv3rblade

Still a problem. says 'syswrite': execution expired (Google::Apis::TransmissionError) as an error and NoMethodError: undefined methodopen_timeout' for #` when I try to alter the parameter. I also tried passing params as a request option but no luck.

@webzorg Not the easiest to read, but try https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/ClientOptions#open_timeout_sec-instance_method

I ended up using:

service.client_options.send_timeout_sec = 1200
service.client_options.open_timeout_sec = 1200

Where, service = Google::Apis::SheetsV4::SheetsService.new

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidraj picture davidraj  路  6Comments

arjunmenon picture arjunmenon  路  5Comments

gimite picture gimite  路  3Comments

eric-hu picture eric-hu  路  4Comments

jiggneshhgohel picture jiggneshhgohel  路  6Comments