Firebase如何免费部署云功能

时间:2020-08-04 10:59:37

标签: node.js firebase google-cloud-functions

我跟踪了一些逐步部署Firebase云功能的教程,但我没有发现该教程中有任何涉及付费或类似的内容,甚至是官方的Firebase文档,但是当我运行Firebase部署此命令时,我会收到此错误

 firebase deploy 

=== Deploying to 'wissal-4736a'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint C:\Users\HP\Desktop\aaaa\functions
> eslint .

+  functions: Finished running predeploy script.
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/wissal-4736a/usage/details

For additional information about this requirement, see Firebase FAQs:

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

所以我应该将我的帐户升级为付费帐户,还是出现一些错误,或者这是一个获得免费帐户的解决方案,因为我是学生 我需要一些帮助,谢谢

1 个答案:

答案 0 :(得分:1)

如错误消息所述,将Cloud Functions部署到Firebase项目需要该项目处于按需付费计划中。这不一定意味着您必须为此付费,因为该计划附带免费套餐。从Firebase pricing page

在Blaze计划中,Cloud Functions提供了永久的免费套餐。每月免费提供前2,000,000次调用,400,000 GB /秒,200,000 CPU-秒和5 GB的Internet出口流量。您只需为超出此免费分配量的使用量付费。

另一种选择是切换到使用Node.js 8运行时,该运行时还不需要帐户在计费计划中。

有关此功能以及有关在Firebase中如何使用Cloud Functions计费的更多信息,请参阅Cloud Functions runtime supportCloud Functions pricing上的常见问题解答。