firebase quota exceeded (per day?) - firebase

Error: quota exceeded (Quota exceeded for quota group 'CPUMilliSecondsDailyNonbillable' and limit 'CPU allocation in function invocations per day' of service 'cloudfunctions.googleapis.com' for consumer 'project_number:221474907579'., Quota exceeded for quota group 'CPUMilliSecondsNonbillable' and limit 'CPU allocation in function invocations per day' of service 'cloudfunctions.googleapis.com' for consumer 'project_number:221474907579'.); to increase quotas, enable billing in your project at https://console.cloud.google.com/billing?project=samsungmap-xyz. Function cannot be executed.
my project still runs fine if i use firebase serve --only functions
but on deployment it shows the above error
It mentions somewhere "per day limit".
Does that mean i can deploy after 24 hrs and quota will reset or something?

You should be able to deploy whenever you want. The functions just won't run until the daily quota resets.

Related

Firebase Get All Auth Users taking Forever in cloudrun

We're trying to fetch 86k of our firebase users, on local & firebase functions it takes 2 minutes for all, but in cloud run it is taking on average 20 seconds per call (you can only request 1k users per calls according to firebase docs).
Interestingly, get all firebase real time database uses takes 15s, but in cloud run it took 365s.
2022-06-17T00:03:04.986000061Zgrabbed users data from db, total: 86442 in 364.015s
2022-06-17T00:03:05.732000112ZProgress 1000 0.746s
2022-06-17T00:03:15.131999969ZProgress 2000 9.847s
2022-06-17T00:03:39.332999944ZProgress 3000 34.347s
2022-06-17T00:04:03.832999944ZProgress 4000 58.846s
2022-06-17T00:04:28.433000087ZProgress 5000 83.447s
2022-06-17T00:04:51.733000040ZProgress 6000 106.747s
2022-06-17T00:05:58.332000017ZProgress 7000 172.947s
Any thoughts on how to solve this? No special network settings in place on cloud run.
Background Info:
Cloud run instance is using NodeJS 14. 2GB Memory which stays at 8% usage. CPU usage stays around 10%. The user object is relatively small, but across all these users it's about 60-70 MB. In firebase functions, only 256 MB of memory are required to do the fetching.
PS: I've yet to test if region makes a difference, as cloud run is in us-east1 and functions are in us-central1. Will be testing soon.

Google Cloud Functions minInstances Pricing

Is there any pricing information regarding deploying cloud functions with minInstances greater than 0? Also, when I deployed the function with runWith({ minInstances: 1}), the edit function page at console.cloud.google.com does not reflect the change.
You can find pricing info on the Firebase Pricing Page. Note this info to figure out the cost of minimum instances
kept idle refers to idle billable time of instances kept warm using minimum instances.
You can also get a quote when you deploy:
Change your function to use minInstances
export const example = functions.https.onCall( ...
export const example = functions.runWith({minInstances: 1}).https.onCall( ...
Deploy via firebase deploy --only functions
The command line should prompt you with a quote and confirmation input such as:
functions: The following functions have reserved minimum instances. This will reduce the frequency of cold starts but increases the minimum cost. You will be charged for the memory allocation and a fraction of the CPU allocation of instances while they are idle.
With these options, your minimum bill will be $153.75 in a 30-day month
? Would you like to proceed with deployment? (y/N)
Also a tip: I use cloud scheduler to keep my functions warm as it's a small fraction of the cost and works just as well for my use case.

Firebase functions invocation/executaion limit is a pain

I am using firebase hosting and functions together to convert PDF TO IMAGE.
For that i wrote a function which takes the file and converts the pdf upload it storage, generates a signedURL and returns it to the user.
In hosting i wrote a rewrite which redirects request from /ecc to ecc function.
Setup worked Well. Website is up and running.
But when i asked a small group of 100 people to use it.
Then firebase functions started throwing err 429 which is too many requests.
Is there any limit on executing functions in 100 Seconds ?
This is the log:
Error: quota exceeded (Quota exceeded for quota group 'CPUMilliSecondsNonbillable' and limit 'CPU allocation in function invocations per 100 seconds' of service 'cloudfunctions.googleapis.com' for consumer 'project_number:992192007775'.); to increase quotas, enable billing in your project at https://console.cloud.google.com/billing?project=myProject. Function cannot be executed.
{"serviceContext":{"service":"ecc"},"context":{"reportLocation":{"functionName":"ecc","lineNumber":0,"filePath":"file"}}}
And in Firebase pricing it says that 125K invocation per month is free but with 40K GB and CPU seconds.
So if i have a function with execution time of 10 seconds i can call only 4000 functions per month ? and with that 16 calls per 100 seconds Limit. where are other 121K function?
Updated Information from Quotas
It's really a head banging thing to understand the limits here this is the main quota page
FUNCTION EXECUTION TIME IS 10 SECOND. AND I'LL CALCULATE THINGS ON THAT.
1,2. CPU allocation in function Invocation PerDay : 150K.
first two are same for some reason.
3. CPU allocation in function invocation per 100 seconds: 100k(0.1% CurrentUsage).
means per 100 second i can "invoke" 10k function.
4. Function invocation per 100 seconds:50. Okay Leave The 3rd Point aside.
5. Read Request Per Day: 50 Maybe same as 4th ?
6. Function invocation per day : 5000 I was having a dream until 4th point opened my eyes.
7. Write request per day : 1000 Function deployment maybe ?
8. Write request per 100 seconds: 20 That's Okay.
Now with all that in mind i can say i can execute 50 functions per 100 seconds.
What my error was QUOTA EXCEEDED 'CPU allocation in function invocations per 100 seconds'
but as per the QUOTA the CPU ALLOC IN FUN INV PER 100 SECOND is 100K !!! ??
How it even exceeded the limit ?
as i said my function execution is about 5-10 seconds and with the invocation limit, maximum seconds would be 500.
What is going on ?, Why QUOTA is exceeding ?
what's the difference beetwen Read and Invoking a function ?
From the error it seems that you have exceeded the quota for Firebase Functions (CPU) per month and as you are using free tier then it's only 40K per month.
Using Firebase Functions in Free tier (Spark) is very limited and it's only for Node 8.
To resolve this you need to upgrade to Blaze plan (pay as you go). which also has free tier:
CPU --> Free up to 200K/month
Please, read more about this here

Google Analytics Limits and Quotas on API Requests (Reporting APIs request errors)

GA doc:
If your request to the Reporting API fails and you get a response code 500 or 503, you can resubmit it. Google Analytics allows:
10 failed requests per project per profile per hour
50 failed requests per project per profile per day
If the number of your failed requests exceeds these quotas, you'll get the following error...
How does GA count these failed requests and set limits? For example, you get a response code 500 at 15:50. So at 15:50 you have 1 error per hour and 1 error per day (the same). The error counter per hour in GA is reset to zero at 16:00 or 16:50?
In the documentation (another section) it is written that
Daily quotas are refreshed at midnight Pacific Standard Time
Does this also apply to failed requests (day's counter)?
How long the profile restriction lasts after exceeding the limits (attempt to make a request to GA after 10 failed requests)
For the failed requests quota, GA counts these failed requests by a continuous running window. In your example, the error counter per hour in GA is reset to zero at 16:50. The error counter per day is reset at 15:50 on the next day.

Suddenly getting Errors : Quota exceeded for quota group 'default' and limit 'Queries per day'

We suddenly started getting errors from Google Analytics while fetching data for transactions..
Quota exceeded for quota group 'default' and limit 'Queries per day' of service 'analytics.googleapis.com' for consumer 'project_number:251xxxxxxx09'. [403]
We had this issue before and it got resolved next day.. but it gets annoying for users.
Is anyone else facing this issue?

Resources