firebase deploy to custom region (eu-central1)
firebaser here
Update (2018-07-25):
It is now possible to specify the region for your Cloud Functions in Firebase you specify that region in your code and deploy the change. E.g.:
exports.myStorageFunction = functions
.region('europe-west1')
.storage
.object()
.onFinalize((object) => {
// ...
});
For full details see the Firebase documentation on Cloud Functions locations (from where I got the above snippet) and modifying the region of a deployed function.
From docs: https://firebase.google.com/docs/functions/locations
Now available in the following regions:
- us-central1 (Iowa)
- us-east1 (South Carolina)
- europe-west1 (Belgium)
- asia-northeast1 (Tokyo)
Best Practices for Changing Region
// before
const functions = require('firebase-functions');
exports.webhook = functions
.https.onRequest((req, res) => {
res.send("Hello");
});
// after
const functions = require('firebase-functions');
exports.webhookEurope = functions
.region('europe-west1')
.https.onRequest((req, res) => {
res.send("Hello");
});
To use the same custom region for all your functions, you do something like this.
import * as functions from 'firebase-functions';
const regionalFunctions = functions.region('europe-west1');
export const helloWorld = regionalFunctions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
export const helloWorld2 = regionalFunctions.https.onRequest((request, response) => {
response.send("Hello from Firebase 2!");
});