【问题标题】:Firebase Functions quota when serving locally using firebase serve --only functions使用 firebase serve --only 函数在本地服务时的 Firebase Functions 配额
【发布时间】:2018-10-15 06:06:57
【问题描述】:

TL;DR

我的 firebase 项目是否会通过使用 $firebase serve --only functions 在本地运行 firebase 函数来产生费用/用完配额?

详情

我的 Firestore 数据库中有一个名为 locations 的集合,其中包含数千个文档,其中包括位置数据,例如 addresspostCode。我想使用外部 api 服务(Open Postcode Geo API)向每个文档添加一些地理位置数据。我编写了一个 HTTP 触发的 firebase 函数,通过点击端点/api/geocodeLocations 触发。此云函数将遍历 locations 集合中的每个文档,并使用 postCode 数据对 Open Postcode Geo 进行 api 调用,该调用将响应地理位置数据(以及其他数据)。然后它将从响应中获取所需的数据并将其写入 firestore 中的文档。

我知道,如果我部署此功能并通过点击 https://my-project/api/geocodeLocations 调用它,我将开始累积我的配额,并且可能会为其发出的外部请求量产生费用(并且很可能超时.. .)。 但是,如果我在我的开发机器上本地运行 $firebase serve --only functions 以模拟功能,然后点击 url http://localhost:5000/my-project/us-central1/app/api/geocodeLocations,我还会为外部请求增加配额吗?

我想我不会,因为请求是在我的本地机器和外部 api 之间,但是我在本地运行时找不到任何关于配额的 firebase 文档。

提前致谢!

【问题讨论】:

    标签: firebase firebase-realtime-database google-cloud-firestore google-cloud-functions


    【解决方案1】:

    以任何方式在本地运行函数不会在 Cloud Functions 产品的计费或配额方面产生任何费用。

    如果您在本地运行的函数中从 Firestore 或实时数据库中读取数据,您仍需要为该访问付费,但与 Cloud Functions 计费或配额无关。

    【讨论】:

    • 感谢道格的回答,非常感谢!
    猜你喜欢
    • 2019-10-30
    • 1970-01-01
    • 1970-01-01
    • 2018-08-14
    • 1970-01-01
    • 1970-01-01
    • 2017-12-17
    • 2020-12-14
    • 2019-01-01
    相关资源
    最近更新 更多