Firebase-functions: Deploy function to multiple region

Created on 12 Sep 2018  路  6Comments  路  Source: firebase/firebase-functions

Can a function be deployed to multiple region?

I read this page(https://firebase.google.com/docs/functions/manage-functions?hl=ja), and, in this page, multiple region is specified in firebase.region function.
Then I tried to deploy one function to multiple region, but the function is only deployed to first one region...

ex:
index.js

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

exports.test = functions.region('us-east1', 'asia-northeast1').https.onRequest((req, res)=>{
    console.log(`in test func`);
    return res.status(200).send('response from test func')
})

then I deployed this function with firebase deploy

Expected result :
this function is deployed to us-east1 and asia-northeast1

Actual result:
this function is only deployed to us-east1

dependencies:
"firebase-admin": "6.0.0",
"firebase-functions": "2.0.5"

bug feature request

Most helpful comment

Fixed! With the next release, you will be able to deploy to multiple regions by passing multiple region strings to functions.region(), like so:
functions.region('us-east1', 'us-central1')...

All 6 comments

Hi, this is certainly in our plans. We currently have a backend bug that prevents this from being launched, so don't try to do this yourself via Cloud Console or gcloud CLI. We are working on fixing the backend bug at the moment. In the meanwhile you can have two functions that have the same code but different names deployed to two regions as a workaround.

I see, thanks.
please let us know if this problem is resolved

Internal bug reference: 111259711

Hi @soichisumi, the backend bug that @laurenzlong mentioned has now been resolved and the fix has been rolled out to production. You can now have two functions with the same name deployed to different regions. We will now be working on adding multi-region support to the SDK so that you can deploy one function to multiple regions like you were trying to do. I'll keep this bug open to reference in the PR.

Fixed! With the next release, you will be able to deploy to multiple regions by passing multiple region strings to functions.region(), like so:
functions.region('us-east1', 'us-central1')...

thank you! this feature is very helpful @joehan

Was this page helpful?
0 / 5 - 0 ratings