函数 us-central1-app 不存在,有效触发器是:europe-west1-app

Function us-central1-app does not exist, valid triggers are: europe-west1-app

我在同一个项目中有 firebase 托管和函数,其中托管重写了对函数的某些 url 请求。它一直运行良好。

但是在函数上将区域从 us-central1 更改为另一个区域后,每当我转到 http://localhost:5000/getoptions

时都会收到此错误
Function us-central1-app does not exist, valid triggers are: europe-west1-app

这是我在 firebase.json 中重写的代码。

"rewrites": [
  {
    "source": "**",
    "function": "app"
  }
]

"rewrites": [
  {
    "source": "**",
    "function": "app"
  }
]

为什么不显示错误?还有办法指定重定向区域吗?

经过多次尝试,我发现自 2021 年起,firebase 托管功能重写仅适用于 us-central1 区域。它在 docs

因此,每当我想在部署的函数中使用我的 API 时,我都必须删除这些重写并使用完整的 URL https://europe-west1-[project name].cloudfunctions.net/app 函数。