question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dailyLimitExceededUnreg for Drive API v3

See original GitHub issue

Hi, I read lots of docs on developers.google, set up my codebase recently, connected within service account’s provided secret_key.json issued for the project on Google Cloud Console which I downloaded & put away safely (hopefully its safe) . Everything seemed fine . Although I get status: 200 with request : { responseURL: https://www.googleapis.com/drive/v3/files?q=trashed%3Dfalse&corpora=user' } the expected JSON for responseURL contains the following message:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "dailyLimitExceededUnreg",
    "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
    "extendedHelp": "https://code.google.com/apis/console"
   }
  ],
  "code": 403,
  "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
 }
}

I’ve checked on documentation , it say quotas may be an issue . Answer is negative , my quotas for Google Drive API is only 0,01%

I may missing a part, but do I need to add billing account before hand for such API “trialling” only ? I am just a regular developer trying to play around with G Workspace APIs.

Environment details

  • OS: Windows Home 10 Windows Feature Experience Pack 120.2212.3920.0
  • Node.js version: 16.13.2
  • npm version: 8.1.2
  • googleapis version: 0.3.0

Steps to reproduce

My codebase:

'use strict';

const drive = require('@googleapis/drive');
const path = require('path');
/* const express = require('express'); */
/* const axios = require('axios'); */

async function main() {

  const auth = new drive.auth.GoogleAuth({ /* as if AuthPlus.GoogleAuth({options}) */
  keyFile: path.join(__dirname, 'secret_key.json'),
  /* keyFilename: path.join(__dirname, 'secret_key.json'), */
    scopes: [
       /* Full list of scopes : @https://developers.google.com/identity/protocols/oauth2/scopes#drive */
      'https://www.googleapis.com/auth/drive', /* : See, edit, create, and delete all of your Google Drive files */
      'https://www.googleapis.com/auth/drive.file', /* : View and manage Google Drive files and folders that you have opened or created with this app */
      'https://www.googleapis.com/auth/drive.appdata', /* : ... */
      'https://www.googleapis.com/auth/drive.metadata', /* : ... */
      'https://www.googleapis.com/auth/drive.metadata.readonly', /* : ... */
      'https://www.googleapis.com/auth/drive.photos.readonly', /* : ... */
      'https://www.googleapis.com/auth/drive.readonly', /* : ... */
    ],
  });

  // Raw reference : @https://googleapis.dev/nodejs/googleapis/latest/drive/classes/Resource$Files.html#list
  // Nice reference : @https://developers.google.com/drive/api/v3/reference/files/list
  
  const _authenticated = drive.drive({version: 'v3', auth})
  const res = await _authenticated.files.list({
    q: 'trashed=false',
    corpora: 'user'
  })

  console.log(res); // full response : for more , please refer to request.responseURL
  
  console.log(res.data.files.length); // 0 # not what expected

}
main().catch(e => {
  console.error(e);
  throw e;
});

Full response I get:

{
  config: {
    url: 'https://www.googleapis.com/drive/v3/files?q=trashed%3Dfalse&corpora=user',
    method: 'GET',
    userAgentDirectives: [ [Object] ],
    paramsSerializer: [Function (anonymous)],
    headers: {
      'x-goog-api-client': 'gdcl/5.0.5 gl-node/16.13.2 auth/7.11.0',
      'Accept-Encoding': 'gzip',
      'User-Agent': 'google-api-nodejs-client/5.0.5 (gzip)',
      Authorization: 'Bearer some_opaque_string_hidden_from_you_guys',
      Accept: 'application/json'
    },
    params: { q: 'trashed=false', corpora: 'user' },
    validateStatus: [Function (anonymous)],
    retry: true,
    responseType: 'json'
  },
  data: { kind: 'drive#fileList', incompleteSearch: false, files: [] },
  headers: {
    'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
    'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
    connection: 'close',
    'content-encoding': 'gzip',
    'content-security-policy': "frame-ancestors 'self'",
    'content-type': 'application/json; charset=UTF-8',
    date: 'Sun, 06 Feb 2022 22:43:19 GMT',
    expires: 'Mon, 01 Jan 1990 00:00:00 GMT',
    pragma: 'no-cache',
    server: 'GSE',
    'transfer-encoding': 'chunked',
    vary: 'Origin, X-Origin',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'SAMEORIGIN',
    'x-xss-protection': '1; mode=block'
  },
  status: 200,
  statusText: 'OK',
  request: {
    responseURL: 'https://www.googleapis.com/drive/v3/files?q=trashed%3Dfalse&corpora=user'
  }
}

Worth to mention: my secret_key.json expires in thousands of years (status: enabled)


It’s not urgent, although some assistance may be appreciated to solve or register as potential bug for this library .

Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
melissarh57commented, Jul 26, 2022

i have this same issue… very lost.

1reaction
projektorius96commented, Aug 1, 2022

@sofisl I am not sure it’s somewhere mentioned on developers.google or any other relevant docs (references) that "you must share the document (in this case – sheet) to service account to be accessible through for APIs, although it may be obvious to some advanced users , but not beginners whatsoever . Thanks !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Drive API throwing userRateLimitExceeded and then ...
2) Why would I be hitting the the dailyLimitExceededUnreg errors? and how can I avoid it? Some snippets of code: Credential credential =...
Read more >
Resolve errors | Google Drive
This guide provides instructions on how to resolve specific API errors. Resolve a 400 error: Bad request. This error can result from any...
Read more >
Google API dailyLimitExceededUnreg Error - Insync Forums
After hours of trying to synchronize (there really is nothing to synchronize, maybe 1 or 2 files, since everything was really synchronized), and ......
Read more >
{ "error": { "errors": [ { "domain": "usageLimits", "reason ...
i am using this code for google drive api ... This is because the scope you use for Drive API is labelled restricted....
Read more >
Google Drive Connector - FME Community - Safe Software
Google Drive: SSL certificate verification failed for host ... url: /drive/v3/files/14VXm0wlvHZuW9tkS46VAWE1MYeIJpkAP?fields=id%2Cname%2CmimeType%2Csize% ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found