【问题标题】:How to set the region for all firebase cloud functions at once?如何一次为所有 Firebase 云功能设置区域?
【发布时间】:2021-12-07 10:44:34
【问题描述】:

我们需要将所有云功能的位置从 'us-central1' 更改为 ('us-central1', 'europe-west1')

我们可以手动检查每个功能并添加.region('us-central1', 'europe-west1'),但我想知道是否有可能一次将所有云功能的全局区域设置为多个区域。

【问题讨论】:

    标签: firebase google-cloud-functions


    【解决方案1】:

    您可以更改 stackoverflow answer 中提到的所有 Firebase 云功能的区域,您还可以参考 documentation1documentation2,其中简要说明了更改 Firebase 云功能的最佳实践如前所述:

    // 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");
        });
    

    【讨论】:

    • @CaitlynCodr 发布了答案,有用吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-31
    • 1970-01-01
    • 1970-01-01
    • 2017-12-21
    • 1970-01-01
    • 2021-03-17
    相关资源
    最近更新 更多