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

Firebase Hosting proxy to Cloud Functions only triggers in us-central1

我使用以下区域创建了我的 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/ instead of asia-northeast1 something like this 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);
});

Firebase 托管目前仅支持将 URL 代理到部署到 us-central1 的函数,如 documentation:

中所述

Important: Firebase Hosting supports Cloud Functions in us-central1 only.

还有here in the docs:

Important: If you are using HTTP functions to serve dynamic content for Firebase Hosting, you must use us-central1.