英文:
Google Cloud Functions timeout limit changes
问题
INVALID_ARGUMENT: 具有事件触发器的函数的超时时间不能超过 540 秒。
这是用于部署和更新的命令(直到今天都可以正常工作):
我可以看到文档 在几天前进行了更新(上次更新于 2023-02-02 UTC)。现在,事件驱动函数的最大超时时间为 540 秒。
因此有两个问题:
- 我的作业有时需要处理大约 15 分钟的文件。现在该怎么办?
- 如何验证超时限制是否是文档的最新更改?
英文:
I have a Google Cloud function that was working for the last weeks. I removed it and try to deploy, getting this error:
> INVALID_ARGUMENT: The timeout for functions with an event trigger cannot exceed 540 seconds.
This was the command used to deploy and update (and it was working until today):
gcloud functions deploy import-XXXXXXX-function \
--gen2 \
--runtime=go119 \
--memory=128Mi \
--timeout=t30m \
--region=$REGION \
--source="$ROOT" \
--entry-point=ImportXXXXXXX \
--trigger-event-filters="type=google.cloud.storage.object.v1.finalized" \
--trigger-event-filters="bucket=$BUCKET" \
--set-env-vars=STAGE=$STAGE
I can see that the documentation was updated days ago (Last updated 2023-02-02 UTC.) and now the max timeout for event-driven functions is 540 seconds.
So two question:
- My job is going to process a files that sometimes is taking around 15 minutes. What to do now?
- How to verify that the timeout limit was the latest change in the doc?
答案1
得分: 1
同意,这是错误的,并且最近发生了变化。
gcloud CLI文档建议--gen2
更高,--gen1
的限制为540秒:
我之前的环境也设置了--timeout=3600
,直到最近都能正常工作。似乎发生了一些变化 :-/
英文:
Agreed this is wrong and has changed recently.
The gcloud cli documentation suggests --gen2
is higher and 540s is the limit for --gen1
:
I also had an environment was a --timeout=3600
which was working until quite recently. Something has changed :-/
答案2
得分: 0
链接如下:
- stackoverflow.com关于Google Cloud Function最大超时时间为540秒未生效的问题
- stackoverflow.com关于运行Firebase Cloud Function超过9分钟(540秒)的问题
如果您需要更多时间进行后台/异步执行,您可以将函数分解为不同部分,或者可以使用其他产品,比如Cloud Run。这里有一个完整的示例可供参考。
您还可以安排使用App Engine或Compute Engine来搭建服务器。
英文:
The timeout has always been 540 seconds. See (and note the dates):
- https://stackoverflow.com/questions/62742049/google-cloud-function-max-timeout-540-seconds-not-working-for-client
- https://stackoverflow.com/questions/68732826/run-firebase-cloud-function-for-more-than-9-mins-540-sec
If you need more time for a background/async execution, you can either break up your function into different parts, or you can use a different product, such as Cloud Run. There is a full example of how to do that.
You could also arrange to use App Engine or Compute Engine to stand up a server.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论