Jivayu Homeopathy
Jivayu Homeopathy

Reputation: 41

I m Not Able to Create any Function on gcp ? Firebase Deploy function error

Firebase Deploy Fails.

Coz "HTTP Error: 400, Could not create Cloud Run service ssrjivayuhomeopathyclinic. spec.template.spec.containers.resources.limits.cpu: Invalid value specified for cpu. For the specified value, maxScale may not exceed 10"

Does it get Refreshed Monthly As mentioned in Quotas ??

Firebase deploy is Failing with error!

Project is nextjs hosted in firebase, ssr in gcp.

I Deleted the Function previously, and deployed , it worked that time

But I m Stuck With the Quotas.

CAn anyone tell me , When it get refreshed or i m done here!

    functions: HTTP Error: 400, Could not create Cloud Run service ssrjivayuhomeopathyclinic. spec.template.spec.containers.resources.limits.cpu: Invalid value specified for cpu. For the specified value, maxScale may not exceed
10.
    Consider running your workload in a region with greater capacity, decreasing your requested cpu-per-instance, or requesting an increase in quota for this region if you are seeing sustained usage near this limit, see https://cloud.google.com/run/quotas. Your project may gain access to further scaling by adding billing information to your account.
    !  functions: failed to create function projects/jivayu-homeopathy-clinic/locations/asia-east1/functions/ssrjivayuhomeopathyclinic
    Failed to create function projects/jivayu-homeopathy-clinic/locations/asia-east1/functions/ssrjivayuhomeopathyclinic

Upvotes: 4

Views: 1543

Answers (4)

Stanislau Buzunko
Stanislau Buzunko

Reputation: 1831

If this is your first deployment of v2, then it's likely all you need to do is wait. In my case, it took approximately 30 minutes for Cloud Run to create a new service.

To double-check if this is your case, go to https://console.cloud.google.com/functions, open your function, and check if it shows the "Creating Cloud Run Service" status.

Logs even say: since this is your first time using functions v2, we need a little bit longer to finish setting everything up, please retry the deployment in a few minutes.

But I didn't expect "a few minutes" to last half of an hour. Someone on Reddit mentioned it that it can take anywhere between 0.5 to 1h from their experience

Upvotes: 0

Alex Pedersen
Alex Pedersen

Reputation: 47

If you are writing a function with Python for 2nd gen Cloud Functions then you can use max_instances parameter in the decorator like this:

@https_fn.on_call(max_instances=10)
def foo(req: https_fn.CallableRequest) -> any:

Upvotes: 1

Fabricio Espinoza
Fabricio Espinoza

Reputation: 463

I think I had exactly the same issue, I solved it by adding maxInstances to the function like this:

exports.helloworld = onRequest(
    {timeoutSeconds: 15, cors: true, maxInstances: 10},
    (req, res) => {
      res.send("I am a function.");
    },
);

Upvotes: 6

nimbous
nimbous

Reputation: 1527

Try setting --max-instances flag explicitly. That worked for me.

Upvotes: 0

Related Questions