Cloud Functions的Firebase托管代理仅在us-central1中触发

时间:2019-09-30 08:31:49

标签: firebase google-cloud-functions firebase-hosting

我有使用以下区域创建的firebase云功能:asia-northeast1,我试图使用firebase.json文件触发其中一个功能。

  "hosting": [
    {
      "target": "ksite",
      "public": "public",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        { "source": "**", "function": "ssr" }
      ]
    }
  ]

不幸的是,这会触发us-central1 https://us-central1-site.cloudfunctions.net/ssr/而不是asia-northeast1这样的https://asia-northeast1-site.cloudfunctions.net/ssr/

区域的函数

这是怎么回事?为什么?

这是我的功能:

// For Universal Rendering
export const ssr = functions.region('asia-northeast1').https.onRequest((request, response) => {
    require(`${process.cwd()}/dist/ksite-webpack/server`).app(request, response);
});

1 个答案:

答案 0 :(得分:3)

Firebase Hosting当前仅支持将URL代理到部署到us-central1的功能,如documentation中所述:

  

重要提示:Firebase托管仅在us-central1中支持云功能。

还有here in the docs

  

重要提示:如果您使用HTTP功能为Firebase Hosting提供动态内容,则必须使用us-central1。

相关问题