Environment info
- firebase-tools version: All versions as of January 2025
- Platform: All platforms
Bug Description
The V2_REGION_TO_TIER mapping in src/deploy/functions/pricing.ts is missing several Cloud Functions regions that are officially supported by Google Cloud. This causes issues when deploying functions with minInstances to these regions.
Symptoms
-
With proper guards: The canCalculateMinInstanceCost() function returns false for missing regions, resulting in a generic warning message: "Cannot calculate the minimum monthly bill for this configuration"
-
Without guards: If monthlyMinInstanceCost() is called directly without checking canCalculateMinInstanceCost() first, it throws:
TypeError: Cannot read properties of undefined (reading 'ram')
Root Cause
When deploying functions with minInstances to a region not in V2_REGION_TO_TIER:
V2_REGION_TO_TIER[endpoint.region] returns undefined
- The code tries to access
usage[endpoint.platform][tier].ram where tier is undefined
- This causes the TypeError or triggers the fallback warning
Missing Regions
According to the official Firebase documentation, the following regions are missing:
Tier 1 regions (missing):
| Region |
Location |
africa-south1 |
Johannesburg |
europe-southwest1 |
Madrid |
europe-west8 |
Milan |
europe-west9 |
Paris |
me-west1 |
Tel Aviv |
us-east5 |
Columbus |
us-south1 |
Dallas |
Tier 2 regions (missing):
| Region |
Location |
asia-south2 |
Delhi |
australia-southeast2 |
Melbourne |
europe-west10 |
Berlin |
europe-west12 |
Turin |
me-central1 |
Doha |
me-central2 |
Dammam |
northamerica-northeast2 |
Toronto |
southamerica-west1 |
Santiago |
Steps to Reproduce
-
Create a Cloud Function with minInstances configured for europe-west8 (Milan) region:
import { onRequest } from "firebase-functions/v2/https";
export const helloMilan = onRequest(
{
region: "europe-west8",
minInstances: 1 // Required to trigger the bug
},
(req, res) => {
res.send("Hello from Milan!");
}
);
-
Run firebase deploy --only functions
-
Observe the warning message about inability to calculate costs (or TypeError if guards are bypassed)
Note: The bug only manifests when minInstances is configured. Functions without minInstances are skipped in the cost calculation loop.
Expected Behavior
The deployment should complete successfully, with correct pricing tier calculation for all officially supported regions.
Proposed Solution
Add all missing regions to the V2_REGION_TO_TIER mapping with their correct pricing tiers as documented in the Cloud Functions pricing page.
Impact
- Affects users deploying to Milan, Johannesburg, Madrid, and other newer regions with
minInstances
- Critical for Italian/European businesses requiring data residency in Italy
- Important for GDPR compliance for organizations in specific EU countries
- Prevents accurate cost estimation for these regions
Additional Context
I'm happy to submit a PR with the fix if this approach is approved.
Environment info
Bug Description
The
V2_REGION_TO_TIERmapping insrc/deploy/functions/pricing.tsis missing several Cloud Functions regions that are officially supported by Google Cloud. This causes issues when deploying functions withminInstancesto these regions.Symptoms
With proper guards: The
canCalculateMinInstanceCost()function returnsfalsefor missing regions, resulting in a generic warning message: "Cannot calculate the minimum monthly bill for this configuration"Without guards: If
monthlyMinInstanceCost()is called directly without checkingcanCalculateMinInstanceCost()first, it throws:Root Cause
When deploying functions with
minInstancesto a region not inV2_REGION_TO_TIER:V2_REGION_TO_TIER[endpoint.region]returnsundefinedusage[endpoint.platform][tier].ramwheretierisundefinedMissing Regions
According to the official Firebase documentation, the following regions are missing:
Tier 1 regions (missing):
africa-south1europe-southwest1europe-west8europe-west9me-west1us-east5us-south1Tier 2 regions (missing):
asia-south2australia-southeast2europe-west10europe-west12me-central1me-central2northamerica-northeast2southamerica-west1Steps to Reproduce
Create a Cloud Function with
minInstancesconfigured foreurope-west8(Milan) region:Run
firebase deploy --only functionsObserve the warning message about inability to calculate costs (or TypeError if guards are bypassed)
Note: The bug only manifests when
minInstancesis configured. Functions withoutminInstancesare skipped in the cost calculation loop.Expected Behavior
The deployment should complete successfully, with correct pricing tier calculation for all officially supported regions.
Proposed Solution
Add all missing regions to the
V2_REGION_TO_TIERmapping with their correct pricing tiers as documented in the Cloud Functions pricing page.Impact
minInstancesAdditional Context
I'm happy to submit a PR with the fix if this approach is approved.