firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

Max number of instances.

Open deepak786 opened this issue 2 years ago • 5 comments

Deployed the v1 event-driven cloud function with the following configuration:

"dependencies": {
    "firebase-admin": "^11.3.0",
    "firebase-functions": "^4.1.0"
},
"engines": {
    "node": "16"
}

The function is without runWith configuration. After deploying, the firebase console automatically shows the max instance limit of 3000.

Screen Shot 2022-12-06 at 3 23 18 PM

Is 3000, the default max limit?

deepak786 avatar Dec 06 '22 09:12 deepak786

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Dec 06 '22 09:12 google-oss-bot

EDIT Turns out I was stuck on an old version of firebase-tools, due to having multiple Node installations (NVM). After fixing the problem, my error went away.

ORIGINAL POST

Getting a probably related error:

Error: Failed to parse build specification:
- FirebaseError Expected endpoints[createNewBillingMonth].minInstances to be a number; was object

This happens when deploying using firebase deploy --only functions.

This is in a function that has a runWith that looks like this:

export const createNewBillingMonth = region('europe-west1')
  .runWith({
    timeoutSeconds: 540,
    memory: '1GB',
  })

If I fill out minInstances, it starts complaining about maxInstances

larssn avatar Dec 07 '22 13:12 larssn

@taeold Can you please look into it?

deepak786 avatar Dec 08 '22 18:12 deepak786

Picking up this for investigation, the endpoint that generates the YAML contract that configures the function on GCP/Firebase sets the maxInstaces to null. According to the contract as far as I know, the default maxInstances is supposed to be 1000

exaby73 avatar Nov 10 '23 12:11 exaby73

Hi @deepak786

This is the default max instances. You can change the maximum number of instances, like the following:

export const helloWorld_v1 = v1.runWith({
  maxInstances: 10,
}).https.onRequest((request, response) => {
  response.send("Hello from Firebase Functions!");
});

export const helloWorld_v2 = v2.https.onRequest({
  maxInstances: 10,
}, (request, response) => {
  response.send("Hello from Firebase Functions!");
});

Thank you for opening this issue. I'm going to close this here. If you have further questions or problems, feel free to reply (and I'll reopen) or open a new issue.

CorieW avatar Jul 22 '25 15:07 CorieW