How to set the region for all firebase cloud functions at once?

Viewed 256

We need to change the location for all of our cloud functions from 'us-central1' to ('us-central1', 'europe-west1')

We can go through every function manually and add .region('us-central1', 'europe-west1') but I wondered if there is a possibility to set the region globally to multiple regions for all cloud functions at once.

1 Answers

You can change the region for all your firebase cloud functions as mentioned in the stackoverflow answer and You can also refer to the documentation1 and documentation2 where a brief explanation provided towards the best practice for changing the firebase Cloud functions as stated:

// before
const functions = require('firebase-functions');

exports.webhook = functions
    .https.onRequest((req, res) => {
            res.send("Hello");
    });

// after
const functions = require('firebase-functions');

exports.webhookAsia = functions
    .region('asia-northeast1')
    .https.onRequest((req, res) => {
            res.send("Hello");
    });
Related