0

I am deploying a Nextjs application, using Firebase Hosting and I encounter this error ....... could not create Cloud Run service PROJECT_ID spec.template.spec.containers.resources.limits.memory: Invalid value specified for memory. For the specified value, maxScale may not exceed 80. Consider running your workload in a region with greater capacity, decreasing your requested memory-per-instances, 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.

All my functions specify region to europe-west2. I added the region to my firebase json file, Inside package.json file the scripts are set up as follows

"scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "serve": "NODE_ENV=production npm run build && firebase emulators:start --only functions,hosting ",
    "deploy": "firebase deploy --only hosting",
    "deploy:dev": "env-cmd -f .env.development npm run build && firebase deploy --only hosting -P <project-dev>",
    "deploy:prod": "env-cmd -f .env.production npm run build && firebase deploy --only hosting -P <project-prod>"
  }
nip
  • 3
  • 1
  • It seems firebase hosting is using Cloud Run underneath. According to cloud run's doc "By default, Cloud Run services are configured to a maximum of 100 instances". Looks like there is a mismatch between the default on cloud run and the region and GCP does not handle it. Is there an "Maximum number of instances" you can configure in firebase hosting? I am not too familiar with it, on cloud run there is a "Maximum number of instances". setting that lets you configure it. – mlablablab May 03 '23 at 17:48
  • 1
    There is a way to set it on functions, but I can't find it for hosting https://stackoverflow.com/questions/64887456/how-to-limit-instance-count-of-firebase-functions , you need something like that. – mlablablab May 03 '23 at 17:58

1 Answers1

1

As explained in FirebaseExtended/firebase-framework-tools.

You can configure the generated functions using "hosting.frameworkBackend" in firebase.json it's the same interface as firebase-functions/v2/https.httpsOptions.

Junaga
  • 292
  • 4
  • 19