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

Cloud Tasks无法使用确定性URL调用Cloud Function的问题

Cloud Functions Gen2 HTTP URL 与 Cloud Tasks 认证问题

Cloud Functions Gen2 目前支持两种类型的HTTP URL:

  • 确定性URL:https://REGION-PROJECT_ID.cloudfunctions.net/FUNCTION_NAME
  • 非确定性URL:https://FUNCTION_NAME-RANDOM_HASH-REGION.a.run.app

使用非确定性URL时,可通过以下OIDC配置创建能与该函数完成认证的Cloud Task:

task: {
  httpRequest: {
    url: "https://FUNCTION_NAME-RANDOM_HASH-REGION.a.run.app/something",
    httpMethod: "POST",
    oidcToken: {
      serviceAccountEmail: "my-function-invoker@my-project.iam.gserviceaccount.com",
    },
    ...
}

但如果把url替换为确定性URL,生成的Cloud Task将无法调用Cloud Function,会触发错误:unaUTHENTICATED(16): HTTP status code 401。

内容的提问来源于stack exchange,提问作者sohrab

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.02 02:43:12