Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

This 503 error indicates that the Google Sheets API is responding with "Service Unavailable" intermi

Affected Product(s): Cloud Run, Google Sheets API

Problem Description
We have a deployed Cloud Run service that experiences intermittent 404 errors when invoked, despite having a minimum of two instances configured to avoid cold start issues.
We have thoroughly investigated the issue and added detailed logs to our application. Thanks to this, we have identified the root cause of the 404 error: it is not coming from our code directly, but from failures in the calls our application makes to the Google Sheets API.
The logs specifically show the following error when our application attempts to communicate with the Google Sheets API:

An error occurred: <HttpError 503 when requesting https://sheets.googleapis.com/v4/spreadsheets/1peaEbC4_-tDOp9UfXgsGzcXs-hWVEyv_uGKtJ6XlOyo/values/Ho... returned "The service is currently unavailable.". Details: "The service is currently unavailable.">

This 503 error indicates that the Google Sheets API is responding with "Service Unavailable" intermittently, which in turn causes our application to fail to process the request.
Diagnostic Steps Performed to Date
Cold Start Validation: Minimum 2 instances configured in Cloud Run.

Quota Check: We've reviewed the Google Sheets API quotas in our GCP console, and while we don't appear to be exceeding the overall limits, the intermittent nature of the quotas suggests potential rate limits or transient issues.

Permissions Review: The Cloud Run service account has the necessary permissions to access the Google Sheets spreadsheet.

This intermittent issue affects the reliability of our Cloud Run service and user experience, as some valid requests receive a 404 error due to the temporary unavailability of the Google Sheets API.

We appreciate any help or information you can provide to mitigate these Google Sheets API 503 errors. We'd love to hear if there are any known issues or specific recommendations for handling these types of issues that we haven't considered, especially if they relate to consuming the API from a Cloud Run service.

0 1 54
1 REPLY 1

Hi @nemes1s,

Welcome to Google Cloud Community!

Based on the troubleshooting guide, you're seeing 503 errors because the Sheets API is overloaded or the spreadsheet/request is too complex. To fix this:

  • Throttle requests to 1 per second per spreadsheet.
  • Use batchUpdate and A1 notation to minimize data.
  • Add exponential backoff with retries.
  • Simplify or split large/complex sheets, and avoid heavy use of IMPORTRANGE or QUERY.
  • Rotate frequently updated sheets and limit spreadsheet access.

These tweaks should reduce the 503s and stabilize your Cloud Run service.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.