简体   繁体   English

Firebase Functions - 您已超出部署配额

[英]Firebase Functions - You have exceeded your deployment quota

I have a Firebase Functions project with 70+ functions.我有一个包含 70 多个函数的 Firebase Functions 项目。 It runs on Node 8.它在节点 8 上运行。

After 5-7 full deployments I am getting an error:在 5-7 次完全部署后,我收到一个错误:

You have exceeded your deployment quota, please deploy your functions in batches by using the --only flag, and wait a few minutes before deploying again. Go to https://firebase.google.com/docs/cli/#deploy_specific_functions to learn more

It is not clear what is the reason for that?不清楚这是什么原因? Which limit I have reached?我达到了哪个限制? When quota will renew?配额什么时候更新?

Deployment is not working after a few minutes.几分钟后部署不工作。

I have asked for help on Firebase Community slack and now I understand what has happened.我已经就 Firebase Community slack 寻求帮助,现在我明白发生了什么。 Thanks, @katowulf.谢谢,@katowulf。

Quotas are described here: https://firebase.google.com/docs/functions/quotas#quota_limits_for_firebase_cli_deployment配额在此处描述: https : //firebase.google.com/docs/functions/quotas#quota_limits_for_firebase_cli_deployment

We have 3 quotas related to deployment which are:我们有 3 个与部署相关的配额,它们是:

  1. API calls (READ) - 1 call per deployment, no matter how many functions API 调用 (READ) - 每次部署调用 1 次,无论有多少函数
  2. API calls (WRITE) - 1 call per function API 调用 (WRITE) - 每个函数调用 1 个
  3. Max build time - A few minutes per function depending on size最长构建时间 - 每个函数几分钟,具体取决于大小

To see which one you have hit you can go to quotas admin: https://console.cloud.google.com/projectselector2/projectselector/iam-admin/quotas?service=cloudfunctions.googleapis.com&usage=ALL&supportedpurview=project要查看您点击了哪一个,您可以转到配额管理: https : //console.cloud.google.com/projectselector2/projectselector/iam-admin/quotas?service= cloudfunctions.googleapis.com&usage = ALL&supportedpurview =project

In my case, I have hit quota 3. Max build time which is limited to 12000 seconds per day (by default).就我而言,我达到了配额3. Max build time限制为每天 12000 秒(默认情况下)。 After some experiments, I have noticed that one function deploy adds around ~70 sec to build time (might be a different number in your case!).经过一些实验,我注意到一个函数 deploy 增加了大约 70 秒的构建时间(在您的情况下可能是不同的数字!)。 So 12000/70 gives around 170 functions deploys per day.因此,12000/70 每天提供大约 170 个功能部署。

On Quotas admin page (second link) you can ask to increase any quota with Edit Quota option.在配额管理页面(第二个链接)上,您可以使用“ Edit Quota选项要求增加任何配额。 36000 sec build time is available without any additional approvals which in my case increased individual functions deploys number to 500+ per day.无需任何额外批准即可获得 36000 秒的构建时间,在我的情况下,这将单个功能的部署数量增加到每天 500 多个。

配额管理员

A quota was reset to 0 around 0:00 UTC-07:00 and my functions are deployed to us-central1.配额在 UTC-07:00 左右 0:00 重置为 0,我的功能部署到 us-central1。 So day seems to have a fixed time slot (it is NOT last 24h moving window).所以一天似乎有一个固定的时间段(它不是最后 24 小时移动窗口)。

For bigger projects, you should not deploy the whole project all at once, but just individual functions like described in a linkhttps://firebase.google.com/docs/cli/#deploy_specific_functions对于较大的项目,您不应一次部署整个项目,而应仅部署单个功能,如链接https://firebase.google.com/docs/cli/#deploy_specific_functions 中所述

Your functions are 70+ so deploying it 5-7 times in a short span will exceed one of the limits mentioned here: https://firebase.google.com/docs/cli/#deployment_quotas您的函数有 70 多个,因此在短时间内部署 5-7 次将超过此处提到的限制之一: https : //firebase.google.com/docs/cli/#deployment_quotas

For each function that the Firebase CLI deploys, these types of rate and time limits are affected:对于 Firebase CLI 部署的每个函数,这些类型的速率和时间限制都会受到影响:

API calls (READ) - 1 call per deployment, no matter how many functions
    Limit: 5000 per 100 seconds
API calls (WRITE) - 1 call per function
    Limit: 80 per 100 seconds
Max build time - A few minutes per function depending on size
    Limit: 120 minutes per day

Here is an example which may relates to your error: https://firebase.google.com/docs/cli/#deployment_quotas这是一个可能与您的错误有关的示例: https : //firebase.google.com/docs/cli/#deployment_quotas

It's possible (though unlikely) that you might exceed a quota that limits the rate or volume of your Firebase deployment operations.您有可能(虽然不太可能)超过限制 Firebase 部署操作的速率或数量的配额。 For example, when deploying very large numbers of functions, you might receive an HTTP 429 Quota error message.例如,在部署大量函数时,您可能会收到 HTTP 429 配额错误消息。 To solve such issues, try using partial deployment or requesting quota increases for specific Firebase services.要解决此类问题,请尝试对特定 Firebase 服务使用部分部署或请求增加配额。 For example, the quota called Write requests per 100 seconds per user might help to resolve the Cloud Functions 429 error cited above.例如,称为每位用户每 100 秒写入请求的配额可能有助于解决上述 Cloud Functions 429 错误。

What you can do is create a script which will call deploy for each function, if you want to deploy every function.如果您想部署每个功能,您可以做的是创建一个脚本,该脚本将为每个功能调用部署。 This will make sure that you don't exceed the limits in your production.这将确保您不会超出生产限制。

In development you know which functions will have changes based on code changes, so you can only deploy modified functions and do your testing.在开发中,您知道哪些函数会根据代码更改而发生变化,因此您只能部署修改后的函数并进行测试。

For solving this issue i maintain a shell file identical to the index.ts file and deeply the functions separately.为了解决这个问题,我维护了一个与 index.ts 文件相同的 shell 文件,并分别维护了这些函数。

please see the image for details详情请看图片单击此处查看图像

Another potential cause for this error as your project grows bigger is the fact that (in a typescript project at least) the deploy command transpiles your code inside a folder called lib next to src.随着项目变大,导致此错误的另一个潜在原因是(至少在 typescript 项目中)deploy 命令将代码转译到 src 旁边名为 lib 的文件夹中。

The issue is that the deploy command does not clean up your build before creating a new one.问题是部署命令在创建新构建之前不会清理您的构建。 Which is fine until you rename some files ou functions.在您重命名某些文件或功能之前,这很好。 Old files remain in the lib folder which may cause some issues.旧文件保留在 lib 文件夹中,这可能会导致一些问题。

The solution I use is to add a predeploy command that removes the lib folder before build it again.我使用的解决方案是添加一个预部署命令,在重新构建之前删除 lib 文件夹。 Checkout my solution here在这里检查我的解决方案

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

相关问题 Firebase 云函数部署错误 - 超出配额 - Firebase Cloud Functions Deploy Error - Quota Exceeded firebase 超出配额(每天?) - firebase quota exceeded (per day?) Firebase 验证短信配额超出此项目 - Firebase Authentication SMS Quota exceeded for this project Firebase 云消息:“超出主题配额” - Firebase Cloud Messaging: "Topic Quota Exceeded" Firebase 已超出此项目错误的云存储配额 - Firebase cloud storage quota has been exceeded for this project error Is Cloud Functions in Firebase Free or Not(Cloud Functions部署需要按需付费(Blaze)计费方案) - Is Cloud Functions in Firebase Free or Not (Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan) 您如何命名 firebase 函数以便您可以单独部署它们? - How do you name your firebase functions so you can deploy them individually? 出现错误:您的客户端无权在 firebase 函数中获取 URL - getting error : Your client does not have permission to get URL in firebase functions firebase 函数中的 solc 导致部署错误 - solc inside firebase functions causes deployment error Firebase 函数 Axios RangeError:超出最大调用堆栈大小 - Firebase Functions Axios RangeError: Maximum Call Stack Size Exceeded
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM