GoogleCloudPlatform / functions-framework-go

FaaS (Function as a service) framework for writing portable Go functions
https://godoc.org/github.com/GoogleCloudPlatform/functions-framework-go
Apache License 2.0
464 stars 63 forks source link

Cloud Functions Deployment is Flaky #165

Closed andreespirela closed 1 year ago

andreespirela commented 1 year ago

1) I'm not sure where to put this issue, so I found this repo that has similar issues so I'll put it here hopefully it's similar to the right place and can be addressed by google.

Context I've been trying to deploy a function for so long, the configuration hasn't changed (this is the deployment instruction)

  - name: 'node'
    entrypoint: 'npm'
    args: ['run', 'create-yaml-env']
  - name: 'gcr.io/cloud-builders/gcloud'
    args: [ 'beta',
            'functions',
            'deploy',
            'em-engine-1',
            '--gen2',
            '--runtime', 'nodejs16',
            '--trigger-http',
            '--entry-point', 'process-function',
            '--source', '.',
            '--allow-unauthenticated',
            '--env-vars-file', '.env.yaml',
            '--max-instances', '1000',
            '--region', 'us-central1',
            '--memory', '8192MB',
            '--timeout', '3600']

Now it's just been constantly failing with the same commit that had a successful deployment:

image

(In yellow the commit hash, which you can see it was once successful)

It keeps saying:

Step #6: ERROR: (gcloud.functions.deploy) INVALID_ARGUMENT: Could not update Cloud Run service em-engine-1. spec.template.spec.containers.resources.limits.cpu: Invalid value specified for cpu. For the specified value, maxScale may not exceed 250.
Step #6: 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.

In the deployment error, even though the one that succeded(51a0631e, shown in the picture) had it set up to 1000. What do I do with this flaky deployment?

ace-n commented 1 year ago

Hi @andreespirela,

Cloud Functions 2nd Generation has the same quota limitations as Cloud Run.

In particular, the max_instances limit is relative to the amount of memory and/or vCPUs you request. max-instances supports up to 1000 2 GB instances specifically. If you increase the instances' memory size to 8 GB (4x), that cuts the maximum number of instances by 4 as well (to 250).

Hope this helps! (Feel free to reopen this issue if it doesn't. 🙂 )