0

I have a script that creates a GCS bucket, links it to firebase and apply firebase rules on the bucket. Recently, I am running into this error that it cannot link the GCS bucket to firebase.

I am using the REST method projects.buckets.addFirebase to import the GCS bucket to firebase. https://firebasestorage.googleapis.com/v1beta/{bucket=projects/*/buckets/*}:addFirebase

The response from the API says that the resource exhausted.

{
  "error": {
    "code": 429,
    "message": "Resource has been exhausted (e.g. check quota).",
    "status": "RESOURCE_EXHAUSTED"
  }
}

So I checked the quota for firebase googleapis and it says the per minute usage has reached the limit. Okay, if that is the case, why doesn't it reset even after days of inactivity. I get the error every time I issue the request. If it is a per minute limit, why doesn't it reset the next minute? If I reach the per minute limit once, can't we use the service ever after?

enter image description here

I tried deleting the firebase security rules (storage and firestore) and still I get the same error.

I really don't understand the error and the quota it is linked to. How do I overcome this error? I am now not able to add any bucket to firebase. I know that we can increase the quota, but I might end up in the same situation when that limit also exceeds.

davidbilla
  • 2,120
  • 1
  • 15
  • 26

2 Answers2

0

When you run out of quota, the task you're trying to complete, such as deploying an app, starting a new project, or contacting an API, usually fails and you get a quota error. Until you free up resources (for allocation quota), the time period resets (for rate quota), or you seek and are granted a quota increase, the task will continue to fail.

This error can be triggered by a message rate quota that has been exceeded, a device message rate quota that has been exceeded, or a topic message rate quota that has been exceeded.

The error 429 indicates that you may be violating Google's Terms of Service (especially under d. API Limitations). When you made too many calls, you were probably put on a blacklist, which expires in some time. The limit for People API. You need to apply for higher quotas.

Setting up monitoring to inform you when you're approaching quota restrictions will help you avoid quota errors. More information on monitoring your quotas may be found in the section Monitoring and alerting on quota metrics later in this publication.

Google does not reveal all the rates that it restricts, ostensibly to prevent circumvention or to allow for more flexibility in enforcement.

Here is also a link regarding Limits and Quotas on API requests.

  • I understand the quota and the limits. But in this case, I don't what is the service for which I have exceeded the quota? How do I find that? The error only says that I have exceeded the quota, but not which quota? – davidbilla Dec 07 '21 at 17:45
  • The issue is not necessary due to a service, kindly consider that “when you made too many calls, you were probably put on a blacklist, which expires at some time”. Now, to check what is the service that could probably provoke the error message, there are two ways to view your current quota using Google Cloud Console: reviewing the Quotas page and using the Cloud Console API dashboard. https://cloud.google.com/docs/quota#viewing_your_quota_console – Jose German Perez Sanchez Dec 07 '21 at 18:50
  • I understand the quota and the blacklist. But how long would it take to reset? Its been 3 weeks now. In the quotes page the firebase API call clearly exceeds the limit. But how does it get reset. I hope that was my original question and I have clearly mentioned it in my question. – davidbilla Dec 08 '21 at 02:52
  • Navigate to App Engine’s settings page: https://console.cloud.google.com/appengine/settings, to lift the spending limit, and then re-try the API requests in 5 minutes. Also, here is a stackoverflow answer related to the same issue that might help: https://stackoverflow.com/questions/56847616/firebase-functions-you-have-exceeded-your-deployment-quota/56847774#56847774 – Jose German Perez Sanchez Dec 08 '21 at 17:35
  • I can't find anything to reset in the appengine settings page. I have deleted the storage buckets, firebase security rules and the firebase API calls are well under the limit. Still I get this error. I really can't figure out what is the quota limit I am hitting? Why doesn't it reset? It's been 3 weeks already. – davidbilla Dec 11 '21 at 02:57
0

Finally, I was able to solve this issue.

Looks like there were some orphaned buckets in the firebase side (that were soft-deleted) and they were causing the issue.

In order to get rid of them I had to issue an API request to list the buckets. https://firebasestorage.googleapis.com/v1beta/{parent=projects/*}/buckets?pageSize=1000

I assume that this cleared the orphaned buckets and after that I was able to create new gcs buckets and add them to firebase https://firebasestorage.googleapis.com/v1beta/{bucket=projects/*/buckets/*}:addFirebase

I was not sure, if this was the issue and the solution to it. So, I tried the same in my another project which also had the same issue. And it worked.

Let me know if this is the right solution, or something that worked out by luck :)

davidbilla
  • 2,120
  • 1
  • 15
  • 26