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
相关产品推荐
相关产品推荐

