google-drive-ruby
google-drive-ruby copied to clipboard
Can list files but not read them
session = GoogleDrive::Session.from_service_account_key(...)
session.files
[11] pry(main)> session.files
=> [<GoogleDrive::Spreadsheet id="GMGGpzvytTnUJdzzTMcC29B6lkExCuKAmjuD81" title="test sheet">,
#<GoogleDrive::File id="oc3RhcnRWxl0B1tfSl1lcl9maYSt8" title="Getting started">]
but then
session.files[0].worksheets
Google::Apis::ClientError: Invalid request from /data/app/vendor/bundle/ruby/2.5.0/gems/google-api-client-0.9.28/lib/google/apis/core/http_command.rb:211:in `check_status'
Version 2.1.2
Same issue when executing following code.
-> spreadsheet.worksheets
Sending HTTP get https://spreadsheets.google.com/feeds/worksheets/xxxxx/private/full?
Sending HTTP get https://spreadsheets.google.com/feeds/worksheets/xxxxx/private/full?
404
404
#<Hurley::Response GET https://spreadsheets.google.com/feeds/worksheets/xxxx/private/full == 404 (3093 bytes) 156ms>
#<Hurley::Response GET https://spreadsheets.google.com/feeds/worksheets/xxxxxx/private/full == 404 (3093 bytes) 156ms>
Caught error Invalid request
Caught error Invalid request
Error - #<Google::Apis::ClientError: Invalid request>
Error - #<Google::Apis::ClientError: Invalid request>
Google::Apis::ClientError: Invalid request
from /app/vendor/bundle/ruby/2.2.0/gems/google-api-client-0.10.0/lib/google/apis/core/http_command.rb:211:in `check_status'
from /app/vendor/bundle/ruby/2.2.0/gems/google-api-client-0.10.0/lib/google/apis/core/http_command.rb:179:in `process_response'
from /app/vendor/bundle/ruby/2.2.0/gems/google-api-client-0.10.0/lib/google/apis/core/http_command.rb:286:in `execute_once'
from /app/vendor/bundle/ruby/2.2.0/gems/google-api-client-0.10.0/lib/google/apis/core/http_command.rb:107:in `block (2 levels) in execute'
from /app/vendor/bundle/ruby/2.2.0/gems/retriable-3.0.1/lib/retriable.rb:50:in `block in retriable'
from /app/vendor/bundle/ruby/2.2.0/gems/retriable-3.0.1/lib/retriable.rb:46:in `times'
from /app/vendor/bundle/ruby/2.2.0/gems/retriable-3.0.1/lib/retriable.rb:46:in `retriable'
from /app/vendor/bundle/ruby/2.2.0/gems/google-api-client-0.10.0/lib/google/apis/core/http_command.rb:104:in `block in execute'
from /app/vendor/bundle/ruby/2.2.0/gems/retriable-3.0.1/lib/retriable.rb:50:in `block in retriable'
from /app/vendor/bundle/ruby/2.2.0/gems/retriable-3.0.1/lib/retriable.rb:46:in `times'
from /app/vendor/bundle/ruby/2.2.0/gems/retriable-3.0.1/lib/retriable.rb:46:in `retriable'
from /app/vendor/bundle/ruby/2.2.0/gems/google-api-client-0.10.0/lib/google/apis/core/http_command.rb:96:in `execute'
from /app/vendor/bundle/ruby/2.2.0/gems/google-api-client-0.10.0/lib/google/apis/core/base_service.rb:353:in `execute_or_queue_command'
from /app/vendor/bundle/ruby/2.2.0/gems/google-api-client-0.10.0/lib/google/apis/core/base_service.rb:246:in `http'
from /app/vendor/bundle/ruby/2.2.0/gems/google_drive-2.1.2/lib/google_drive/api_client_fetcher.rb:33:in `request_raw'
from /app/vendor/bundle/ruby/2.2.0/gems/google_drive-2.1.2/lib/google_drive/session.rb:479:in `block in request'
from /app/vendor/bundle/ruby/2.2.0/gems/google_drive-2.1.2/lib/google_drive/session.rb:478:in `loop'
from /app/vendor/bundle/ruby/2.2.0/gems/google_drive-2.1.2/lib/google_drive/session.rb:478:in `request'
from /app/vendor/bundle/ruby/2.2.0/gems/google_drive-2.1.2/lib/google_drive/spreadsheet.rb:44:in `worksheets'
from (irb):86
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:9:in `require'
from bin/rails:9:in `<main>'irb(main):087:0>
I am starting again to received the 404 error...
Response code 404 for get https://spreadsheets.google.com/feeds/worksheets/xxx/private/full
Last time it suddenly fix itself...
Hello, I am receiving this same error in a production instance. This has been happening since August 11 and is impacting internal processes.
I am seeing the below error after removing your messages from the check_status
method:
GoogleDrive::Error: https://spreadsheets.google.com/feeds/worksheets/<REMOVED>/private/full doesn't look like a worksheets feed URL because its root is not <feed>.
https://cloud.google.com/blog/products/g-suite/migrate-your-apps-use-latest-sheets-api This may be related as I wonder if this issue is only impacting users whose gem is using v3.
Also having the same error - it happened sometime between the 6th and the 13th of August 2021.
It's breaking on the .worksheets
method. I also tried similar methods such as .worksheet_by_title
but that also didn't work.
The gem version I'm using is also 2.1.2.
Anyone knows a work around, or if another version of them gem (even if it's 3.x.x) works?
Thanks!
We had the same issue and were able to fix it, hope it helps at least some of you.
- upgrade gem to 3.0.7 ( i don't know if any earlier versions would work )
- after the upgrade, the error should change to something like enable Google Sheets API in you project (there should be a link in the error message, follow it and enable the API)
Up until recently we only had google drive api enabled and it was fine. My best guess is that something about auth in google apis changed a couple of weeks ago.