Unable to deploy Gen2 Cloud Function and Firebase Project from CLI

873 views
Skip to first unread message

RamaMohan P

unread,
Apr 14, 2023, 5:19:09 PM4/14/23
to Firebase Google Group
Hi Firebase team,

I am looking for your help on deploying cloud function Gen2 with next,js SSR framework.

Trying to deploy using firebase deploy command line,  I have a valid pament method setup with Blaze plan. I have gen1 functions , trying to deploy gen2 function for Server Side rendering , blocked with this error. please advise.

I have attached firebase debug log for details.

It says below error 

          "code": 400,
            "message": "Could not create Cloud Run service ssrrelivecricket. spec.template.spec.containers.resources.limits.cpu: Invalid value specified for cpu. For the specified value, maxScale may not exceed 10.\nConsider 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.",
            "status": "INVALID_ARGUMENT"


 

[debug] [2023-04-14T14:39:35.552Z] Functions deploy failed.
[debug] [2023-04-14T14:39:35.553Z] {
  "endpoint": {
    "id": "ssrrelivecricket",
    "project": "cricvideos-11184",
    "region": "us-central1",
    "entryPoint": "ssrrelivecricket",
    "platform": "gcfv2",
    "runtime": "nodejs18",
    "httpsTrigger": {},
    "labels": {
      "deployment-tool": "cli-firebase"
    },
    "environmentVariables": {
      "__FIREBASE_FRAMEWORKS_ENTRY__": "next.js",
      "FIREBASE_CONFIG": "{\"projectId\":\"cricvideos-11184\",\"databaseURL\":\"https://cricvideos-11184.firebaseio.com\",\"storageBucket\":\"cricvideos-11184.appspot.com\",\"locationId\":\"us-central\"}",
      "GCLOUD_PROJECT": "cricvideos-11184",
      "EVENTARC_CLOUD_EVENT_SOURCE": "projects/cricvideos-11184/locations/us-central1/services/ssrrelivecricket"
    },
    "codebase": "firebase-frameworks-relivecricket",
    "cpu": 1,
    "concurrency": 80,
    "targetedByOnly": true,
    "hash": "fabcde982b63a413f465705d073c8bce5567f4d6"
  },
  "op": "create",
  "original": {
    "name": "FirebaseError",
    "children": [],
    "context": {
      "function": "projects/cricvideos-11184/locations/us-central1/functions/ssrrelivecricket"
    },
    "exit": 1,
    "message": "Failed to create function projects/cricvideos-11184/locations/us-central1/functions/ssrrelivecricket",
    "original": {
      "name": "FirebaseError",
      "children": [],
      "context": {
        "body": {
          "error": {
            "code": 400,
            "message": "Could not create Cloud Run service ssrrelivecricket. spec.template.spec.containers.resources.limits.cpu: Invalid value specified for cpu. For the specified value, maxScale may not exceed 10.\nConsider 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.",
            "status": "INVALID_ARGUMENT"
          }
        },
        "response": {
          "statusCode": 400
        }
      },
      "exit": 1,
      "message": "HTTP Error: 400, Could not create Cloud Run service ssrrelivecricket. spec.template.spec.containers.resources.limits.cpu: Invalid value specified for cpu. For the specified value, maxScale may not exceed 10.\nConsider 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.",
      "status": 400
    },
    "status": 400
  }
}
[debug] [2023-04-14T14:39:35.668Z] Error: Failed to create function ssrrelivecricket in region us-central1
    at /usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:48:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Fabricator.createV2Function (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:271:32)
    at async Fabricator.createEndpoint (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:132:13)
    at async handle (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:85:17)
[error]
[error] Error: There was an error deploying functions

Dale Nguyen

unread,
Apr 17, 2023, 12:12:19 AM4/17/23
to Firebase Google Group
In the deploy script, you can add the options for max instance  <= 10 for it to work. 

--max-instances=10

RamaMohan P

unread,
Apr 17, 2023, 11:07:54 AM4/17/23
to Firebase Google Group
Hi Dale,

This data parameter of max -instance is coming by default.

Can you help me with how can we pass/override this information -max-instances=10 ,cpu memory variable data on CLI while doing deployment using the Firebase deploy command?

I tried the below command with different variations to make this work but could not succeed. Can you please advise?


gcloud functions deploy ssrrelivecricket --gen2 --runtime=nodejs18 --region=us-central1 --source=relivecricket  --entry-point=ssr --trigger-http --allow-unauthenticated --set-env-vars FUNCTION_MEMORY_MB=512m --memory 512m --max-

instances 29


And have one more question:


let's assume we have done this function deployment individually using the above command.


Does the Firebase deploy command aware of this function deployment while deploying the Next.Js code base app to Firebase hosting? or

Will this function try to deploy again while doing full app deployment to Firebase hosting?



Dale Nguyen

unread,
Apr 18, 2023, 11:39:09 PM4/18/23
to Firebase Google Group
Hi RamaMohan,

It is literally in your command. You set the max instances to 29, which exceeds the threshold. You can set it back to something less than 10.

Thanks,
Reply all
Reply to author
Forward
0 new messages