You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Cloud Functions 2nd gen重复执行问题咨询

Google Cloud Functions 2nd gen 函数重复执行问题

近期切换到Google Cloud Functions 2nd gen后,遇到了函数重复执行的问题——代码和之前1st gen版本完全一致,但函数执行到末尾后会重新启动运行。

我的入口函数为hello_world,极简测试代码如下:

def hello_world(request):
    print('start')
    print('Stop')
    return 'Hello World!'

即使是这段代码,函数仍会执行两次(日志中会重复输出start和Stop)。我使用的是HTTP触发器,基础配置无认证,且仅触发一次。

后续针对更复杂函数的测试发现:

  • 通过Postman触发仅执行一次
  • 浏览器隐私模式下触发仅执行一次
  • 普通浏览器触发执行两次
  • Cloud Scheduler触发执行三次!

内容的提问来源于stack exchange,提问作者The App Investor

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 14:18:10