Hi,
Im using the Tasks API to create a dynamic tasks list. I get an error for a quota being exceeded after around 100 tasks.insert() calls.
What quota am I hitting?
Error:
Error details: {"details":{"errors":[{"reason":"quotaExceeded","message":"Quota Exceeded","domain":"usageLimits"}],"code":403,"message":"Quota Exceeded"},"name":"GoogleJsonResponseException"}
Hi @jjtjoseph,
Welcome to Google Cloud Community!
You're getting a "Quota Exceeded" error, even though you haven't hit the known daily or per-minute limits for the Google Tasks API. This means you've likely triggered a hidden limit on how quickly you can send requests.
Here are some guides and workaround that might help:
Sample code:
function insertTasksWithBackoff(tasks) {
const batchSize = 20;
let delay = 1000; // Initial delay in milliseconds (1 second)
for (let i = 0; i < tasks.length; i += batchSize) {
const batch = tasks.slice(i, i + batchSize);
try {
// Your tasks.insert() call here, using the 'batch' array
Utilities.sleep(delay); // Wait before the next batch
delay = 1000; // Reset delay for the next batch
} catch (error) {
console.error("Error inserting tasks:", error);
delay *= 2; // Double the delay on error
i -= batchSize; // Retry the current batch
Utilities.sleep(delay);
}
}
}
For your reference, you may refer to these documentations:
If you need further assistance into what specific implicit quota you're hitting, please feel free to reach out to our support team.
I hope the above information is helpful.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 |