firebasegoogle-cloud-functionsfirebase-cli

How to limit instance count of firebase functions


I use following firebase cli command to deploy my firebase functions

firebase deploy --only functions

How can I limit the number of instances for functions, when deployed like this? It looks like gcloud command has --max-instances option to limit instances, but couldn't find anything like this for firebase cli.


Solution

  • You can set the maxInstances when you write the function, using runWith and passing in RuntimeOptions

    Something like this:

     functions
    .runWith({maxInstances: 3})
    .https.onCall(() => {});