Fastlane + Google Drive API - File not found for Google Sheet

610 views Asked by At

I created an OAuth key which should enable me to view and fetch content from a Google sheet (i.e. CLI access to a sheet which gives read/write to all kabaminc.com people) by following the google-drive-ruby library docs, but I get a File Not Found error for a Google sheet that is at the root of my Google Drive with Share permissions being "Anyone at can find and view" when I try to fetch based on doc id from within a Fastlane action:

/<path>/.rvm/gems/ruby-2.5.1/gems/google-api-client-0.21.2/lib/google/apis/core/http_command.rb:218:in `check_status': [!] notFound: File not found: <doc_id> (Google::Apis::ClientError)

I did check the key and ensured the scope was correct:

  "scope": [
     "https://www.googleapis.com/auth/drive",
     "https://spreadsheets.google.com/feeds/"
  ],

As a bit of supplementary information which might or might not be pertinent, my organization uses Okta synced to Active Directory; therefore, to connect to G Suite, I use my Okta credentials.

Using Ruby 2.5.1 with the following pertinent Gems:

  • google-api-client (0.24.3, 0.21.2)
  • google_drive (2.1.12)
  • googleauth (0.7.1, 0.6.7)
  • fastlane (2.107.0)

From the Gemfile.lock:

fastlane (2.107.0)
  CFPropertyList (>= 2.3, < 4.0.0)
  addressable (>= 2.3, < 3.0.0)
  babosa (>= 1.0.2, < 2.0.0)
  bundler (>= 1.12.0, < 2.0.0)
  colored
  commander-fastlane (>= 4.4.6, < 5.0.0)
  dotenv (>= 2.1.1, < 3.0.0)
  emoji_regex (~> 0.1)
  excon (>= 0.45.0, < 1.0.0)
  faraday (~> 0.9)
  faraday-cookie_jar (~> 0.0.6)
  faraday_middleware (~> 0.9)
  fastimage (>= 2.1.0, < 3.0.0)
  gh_inspector (>= 1.1.2, < 2.0.0)
  google-api-client (>= 0.21.2, < 0.24.0)
  highline (>= 1.7.2, < 2.0.0)
  json (< 3.0.0)
  mini_magick (~> 4.5.1)
  multi_json
  multi_xml (~> 0.5)
  multipart-post (~> 2.0.0)
  plist (>= 3.1.0, < 4.0.0)
  public_suffix (~> 2.0.0)
  rubyzip (>= 1.2.2, < 2.0.0)
  security (= 0.1.3)
  simctl (~> 1.6.3)
  slack-notifier (>= 2.0.0, < 3.0.0)
  terminal-notifier (>= 1.6.2, < 2.0.0)
  terminal-table (>= 1.4.5, < 2.0.0)
  tty-screen (>= 0.6.3, < 1.0.0)
  tty-spinner (>= 0.8.0, < 1.0.0)
  word_wrap (~> 1.0.0)
  xcodeproj (>= 1.6.0, < 2.0.0)
  xcpretty (~> 0.3.0)
  xcpretty-travis-formatter (>= 0.0.3)
google-api-client (0.21.2)
  addressable (~> 2.5, >= 2.5.1)
  googleauth (>= 0.5, < 0.7.0)
  httpclient (>= 2.8.1, < 3.0)
  mime-types (~> 3.0)
  representable (~> 3.0)
  retriable (>= 2.0, < 4.0)
google_drive (2.1.12)
  google-api-client (>= 0.11.0, < 0.22.0)
  googleauth (>= 0.5.0, < 1.0.0)
  nokogiri (>= 1.5.3, < 2.0.0)
googleauth (0.6.7)
  faraday (~> 0.12)
  jwt (>= 1.4, < 3.0)
  memoist (~> 0.16)
  multi_json (~> 1.11)
  os (>= 0.9, < 2.0)
  signet (~> 0.7)

Thanks for reading and for your help, folks! I've been tearing my hair out over this one...

EDIT: The sheet is in My Drive, not in a Team Drive, so this Team Drive Support issue might not be relevant, but might help others!

1

There are 1 answers

0
Wanda B. On BEST ANSWER

The issue was that I was reading the doc id in from a file which had been created using Vim (which puts newline at end of file automatically); this newline was what caused issues.