Firebase 中的 Cloud Functions 是否免费(Cloud Functions 部署需要按需付费 (Blaze) 计费计划)

Is Cloud Functions in Firebase Free or Not (Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan)

当我进行第一个部署功能时,我无法部署,因为我有错误要求我将我的帐户升级到 Blaze 我需要知道我可以在使用免费帐户时部署功能吗??

输出:

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
!  functions: missing required API cloudbuild.googleapis.com. Enabling now...
+  functions: required API cloudfunctions.googleapis.com is enabled

Error: Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan. To upgrade your project, visit the following URL:

https://console.firebase.google.com/project/institute-for-admin/usage/details

For additional information about this requirement, see Firebase FAQs:

https://firebase.google.com/support/faq#functions-runtime

如消息所述,如果您以 nodejs 10 为目标,则无法在 Spark 免费层上部署函数。Read the link to the FAQ:

Why will I need a billing account to use the Node.js 10 runtime for Cloud Functions for Firebase?

Because of updates to its underlying architecture planned for August 17, 2020, Cloud Functions for Firebase will rely on some additional paid Google services: Cloud Build, Container Registry, and Cloud Storage. These architecture updates will apply for functions deployed to the Node.js 10 runtime. Usage of these services will be billed in addition to existing pricing.

In the new architecture, Cloud Build supports the deployment of functions. You'll be billed only for the computing time required to build a function's runtime container.

Cloud Storage, interoperating with Google Container Registry, will provide storage space for the containers in which functions run. You'll be billed for each container required to deploy a function. If you're currently using Cloud Functions within free usage limits, you may notice new, small charges for each container stored— for example, 1GB of storage is billed at [=10=].026 per month.

To understand more about how your bill might change, please review the following

如果你想以节点 8 为目标,那可能仍然有效。但它已被弃用,您的功能最终将停止工作。在这种情况下,您仍然需要 migrate them to node 10,并提供一个结算帐户。

Cloud Functions 仍然有 documented in the pricing page 的每月免费限额。但是您必须提供信用卡并使用计费计划才能使用它。您将负责支付任何每月超额费用。

目前,firebase 正在使用节点版本 10 的云功能,需要您付费(即付即用)。

您可以在 functions/package.json

中将节点从 10 更改为 8(免费使用)
"engines": {
    "node": "8". // changed from 10 to 8
  },

但是,这很快就会被弃用。 firebase 网站是这样说的:

Node.js 8 has been deprecated. Starting Feb 15, 2021, we'll no longer support new deploys or updates of Node.js 8 functions. Starting Mar 15, 2021, we'll no longer support executions of existing Node.js 8 functions.

https://firebase.google.com/support/faq?authuser=0#expandable-10-label

编辑

这可能是一个遗产。请查看最新评论以获取更新的政策。

只是为了澄清这里的混乱

Firebase 似乎关闭了 spark 计划的云功能。所以,我想如果 firebase 打算一项一项地取消免费计划的功能怎么办。

这是来自他们的常见问题解答页面的answer

Does this change to Cloud Functions mean the Firebase free plan (Spark) is going away?

No. This change will not affect the other Firebase products. The Spark plan is going to be unavailable for Cloud Functions after March 15, 2021.

在我写这些行的时候 node.js 8 不再可用 'The Spark plan is unavailable for Cloud Functions after March 15, 2021' 所以我认为我们已经迁移到 node.js 10 及更高版本但没有免费计划:我们必须 'pay as we go' 通过提供我们的卡号系列。请注意,如果我们注意到超出某些限制,此 'blazer plan' 可能是免费的 有关详细信息,请参阅此 免费开始, 然后随用随付

截至 2020 年 6 月 8 日,答案是 不,它不再免费了 它曾经是将引擎设置为遗留节点 8 的选项,但 as firebase states

Node.js 8 (deprecated on June 8, 2020) Deployment of functions to the Node.js 8 runtime was disabled in the Firebase CLI on December 15, 2020. Execution of already-deployed functions will stop at some point in the future; if you have deployed functions to the Node.js 8 runtime, we recommend that you upgrade to the Node.js 14 runtime.

因此它不再是一个选项

我不认为 Cloud Function 是免费的,即使您保持在免费配额之内,因为它们似乎对容器存储收费,容器存储似乎是在您部署函数时自动创建的。