简体   繁体   English

Cloud Functions for Firebase - 未配置结算帐号

[英]Cloud Functions for Firebase - Billing account not configured

I just implemented the new Cloud Functions for Firebase, but there something in the log that bothers me:我刚刚为 Firebase 实现了新的 Cloud Functions,但日志中有一些让我烦恼的东西:

Billing account not configured.未配置结算帐号。 External network is not accessible and quotas are severily limited.无法访问外部网络,并且配额受到严格限制。 Configure billing account to remove these restrictions配置结算帐号以移除这些限制

I actually managed to access the function from the external network, so I'm wondering do I really have to give my billing account?我实际上设法从外部网络访问了该功能,所以我想知道我真的必须提供我的帐单帐户吗? There's nothing about this in the firebase documentation. firebase 文档中没有任何关于此的内容。

I'm using the Spark subscription plan for personal test purposes and I don't want to add billing info if I'm not going to pay for anything yet.我将 Spark 订阅计划用于个人测试目的,如果我不打算支付任何费用,我不想添加帐单信息。


The "Billing account not configured" warning message is automatically logged by Google Cloud Functions when no billing account is configured.未配置结算帐号时,Google Cloud Functions 会自动记录“未配置结算帐号”警告消息。 It doesn't mean that your code isn't working, but it merely there as a reminder just in case you have a problem.这并不意味着您的代码不起作用,而只是作为提醒,以防万一您遇到问题。


The restriction is about outbound access - eg can your Function request resources from the general internet.限制是关于出站访问 - 例如,您的功能可以从通用互联网请求资源。 Its absolutely fine to use a function to respond to a webhook, or to access Google-internal services such a the Realtime Database.使用函数来响应 webhook 或访问 Google 内部服务(例如实时数据库)绝对没问题。

If you wanted to call a third party web service (for example) you'd need to enable billing.如果您想调用第三方网络服务(例如),您需要启用计费。

For the other quotas, take a look at: https://firebase.google.com/pricing/ - as you can see there are limits to the number of invocations (125,000 at time of writing) and CPU and memory (40k cpu-seconds and 40k GB-seconds) in the free tier.对于其他配额,请查看: https : //firebase.google.com/pricing/ - 如您所见,调用次数(撰写本文时为 125,000)以及 CPU 和内存(40k cpu-秒和 40k GB 秒)在免费层。

Doug stevenson's answers helped me best:道格史蒂文森的回答对我帮助最大:

TL;DR: It's a warning message. TL;DR:这是一条警告信息。 if you are not doing outbound calls, you are fine如果你不打外线电话,你没问题

That warning message appears for all functions when executing on the Spark plan.在 Spark 计划上执行时,所有函数都会出现该警告消息。 It's just a warning - you can ignore it if you're doing doing any outbound networking in your own own.这只是一个警告 - 如果您自己进行任何出站网络,则可以忽略它。

We're looking into getting that message changed or removed so that it's less confusing.我们正在考虑更改或删除该消息,以减少混淆。

[...] [...]

Make sure that your project is linked to a billing account.确保您的项目与结算帐号相关联。

If you navigate to https://console.cloud.google.com/billing如果您导航到https://console.cloud.google.com/billing

You should be able to find your Firebase project listed there.您应该能够在那里找到您的 Firebase 项目。 If not, then you will need to go to the list of projects, and from your projects menu, select billing then link a billing account to it.如果没有,那么您需要转到项目列表,然后从您的项目菜单中选择计费,然后将计费帐户链接到它。

在此处输入图片说明

The first invocation happens but gets marked when it is in spark plan and gets invoked from an external network ( look at logs )第一次调用发生但在火花计划中被标记并从外部网络调用(查看日志)

At the time of this writing, Plan called BLAZE (Pay as you go) allows networking ( external access ) and has a perpetual free tier.在撰写本文时,名为 BLAZE(即用即付)的计划允许联网(外部访问)并具有永久免费层。

The first 2,000,000 invocations, 400,000 GB-sec, 200,000 CPU-sec, and 5GB of Internet egress traffic is provided for free each month.每月免费提供前 2,000,000 次调用、400,000 GB 秒、200,000 CPU 秒和 5GB 互联网出口流量。 You are only charged on usage past this free allotment.您只需为超过此免费配额的使用量付费。

More on cloud function pricing https://cloud.google.com/functions/pricing有关云功能定价的更多信息https://cloud.google.com/functions/pricing

1.Depreciate the Node Version set node version 8 1.Depreciate Node Version set node version 8

   "engines": {
   "node": "8"
   },

2.Then deploy firebase by following command as You guys Know 2.然后按照你们知道的命令部署firebase

> firebase deploy
Then you'll get this type of https://i.stack.imgur.com/4hWQZ.png output in your terminal if you noticed above image marked with red line this is your firebase project hosted region. 然后,如果您注意到上面标有红线的图像这是您的 firebase 项目托管区域,您将在终端中获得这种类型的https://i.stack.imgur.com/4hWQZ.png输出 if you too also get same result everything is done we are in final step 如果您也得到相同的结果,一切都已完成,我们已进入最后一步

manually we have to hit our project endpoint我们必须手动点击我们的项目端点

 https://yourregion-firebaseprojectname.cloudfunctions.net/yourfunctionname
 (exported function name)
 

In my case https://us-central1-socialape-d5dab.cloudfunctions.net/helloWorld就我而言https://us-central1-socialape-d5dab.cloudfunctions.net/helloWorld

or follow this steps或者按照这个步骤

1.Depreciate node version to 8 
2. firebase deploy  
3. you'll get deploy complete message above that message you'll see 
   functions[helloWorld(us-central)]:Succesful update operation .
4. this us-central  is your project hosted region 
   prefix to this [helloWorld   is your function name  get this information from uour output terminal.   
5.  After  that https://yourregion-firebaseprojectname.cloudfunctions.net/yourfunctionname
 (exported function name)       which is  helloWorld

Yes you need to upgrade to blaze plan from your existing free plan which is spark.是的,您需要从现有的免费计划(即 spark)升级到 blaze 计划。 You wont be charged until you exceed the spark plan benefits.除非您超过 Spark 计划的福利,否则不会向您收费。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM