ADR 0004: Deploy All Cloud Functions to europe-west1
- Status: โ Accepted
- Date: 2025-08-20
- Deciders: Akshay
- Tags: infrastructure, region
Contextโ
Firebase Cloud Functions default to us-central1. We need to pick a region for:
- Latency to primary user base
- Colocation with Firestore / Storage
- Regulatory / data-residency fit
- Cost parity
At the time of decision, the primary user base is in Europe (UK + Mainland), and the Firebase project was provisioned with a multi-region bucket in eur3 (Europe).
Options Consideredโ
A. us-central1 (default)โ
- Pros: Default; lowest latency to GCP control plane; widest feature set
- Cons: 100-200ms RTT from Europe; data crosses Atlantic on every call
B. europe-west1 (Belgium)โ
- Pros: Low latency to UK/EU users; colocated with Firebase eur3 storage; same GCP price class as us-central1
- Cons: Slightly fewer preview features land first; some 3rd-party services have US-only endpoints
C. europe-west2 (London)โ
- Pros: Closest to UK users
- Cons: ~10% more expensive; no Firebase-specific advantage over west1
D. asia-south1โ
- Pros: Low latency to India-based contributors
- Cons: Not where users are; further from Firestore eur3
Decisionโ
Deploy all Cloud Functions to europe-west1. Codified as REGION = "europe-west1" in shared/config.ts so it's imported by every function.
Consequencesโ
Positiveโ
- Low user-perceived latency on callable functions (~30-60ms from UK)
- Colocated with storage โ no cross-region egress on Storage triggers
- One region = one source of truth
Negativeโ
-
Client code must specify the region explicitly, or calls silently route to
us-central1and fail. This is an ongoing footgun:// โ CorrectFirebaseFunctions.instanceFor(region: 'europe-west1');// โ Silent failureFirebaseFunctions.instance; -
Documented prominently in Troubleshooting and Frontend Overview
-
Preview Firebase features sometimes launch in
us-central1first and are unavailable to us for weeks
Neutralโ
- Flutter uses
FirebaseFunctions.instanceFor(region: 'europe-west1'); the admin web app usesgetFunctions(app, 'europe-west1'). - When running the emulator, the region is ignored โ tests work regardless
Follow-up Actionsโ
- Centralize
REGIONconstant inshared/config.ts - Document in every relevant doc page (overview, troubleshooting, frontend, deployment)
- Verify every current Flutter Functions client specifies
europe-west1 - Verify the admin Functions client specifies
europe-west1 - Consider a single Flutter wrapper if the number of direct clients grows
Referencesโ
acesense-auth-function/shared/config.ts- Troubleshooting
- Configuration Reference
Was this page helpful?