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

Support runtime API to update minInstances for Firebase Functions v2

Open mcoevert opened this issue 5 months ago • 2 comments

Firebase Functions v2 allows us to set minInstances via runWith() or firebase.json at deploy time. However, there is currently no way to update this value programmatically at runtime (e.g. via REST API or Admin SDK).

Use case: We want to scale a function up or down (e.g. from 0 to 5 min instances) based on time or usage pattern. For example: • Increase minInstances at 8:00am before peak hours • Reduce minInstances back to 0 at 8:00pm to save costs

This kind of time-based or traffic-driven scaling works great in Cloud Run (via Admin API PATCH), but fails on Firebase Functions v2 because the underlying Cloud Run service is not modifiable via API (returns 404).

Proposal: Expose a way (via Firebase Admin SDK or REST API) to update minInstances on deployed Functions v2 services without requiring a full firebase deploy.

Why it matters: • It avoids unnecessary redeploys • Allows dynamic cost-saving patterns • Fits the modern serverless scaling expectations

mcoevert avatar Jul 07 '25 09:07 mcoevert

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 Jul 07 '25 09:07 google-oss-bot

Hi @mcoevert , thank you opening this issue and bringing this to our attention. We shall review and keep you posted on any developments. Kind regards!

HassanBahati avatar Jul 08 '25 06:07 HassanBahati