Skip to main content
 首页 » 编程设计

python之在 Firebase 托管中使用 Python Google Cloud Function

2024年11月01日8jillzhang

我有一个名为“artificiellt_osterbotten”的 Python 谷歌云函数(不是 Firebase 函数),我想通过 Firebase 托管来触发它。这是我的 firebase.json 文件:

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

该路由似乎有效,但我得到的只是 404。我假设这与 Firebase 和 GCP 之间的断开连接有关。但是,该函数确实显示在 Firebase 控制台中。

有人知道这里的问题是什么吗?甚至可以从 Firebase 托管触发 GCP 云功能吗?

我已将我的 Firebase 计划升级到 Blaze。

请您参考如下方法:

事实证明,我只需要将函数置于 us-central1 中即可运行。希望它可以在 CLI 中警告我,这样可以节省我几个小时!

对于 future 的读者,有一个 open issue firebase 正在处理此问题,看来要么会发出警告,要么会提供多区域支持。