小编pai*_*seq的帖子

Cloud Function 的端点返回 403 Forbidden

我正在按照 Google 的教程为我的云功能设置端点。

当我尝试使用 URL 从浏览器访问端点时,service_name.a.run.app/function1我得到

Error: Forbidden
Your client does not have permission to get URL /function1GET from this server
Run Code Online (Sandbox Code Playgroud)

作为上述教程和Google 产品经理的回答的一部分,我通过授予 ESP 调用我的函数的权限来保护我的函数。

gcloud beta functions add-iam-policy-binding function1 --member "serviceAccount:id-compute@developer.gserviceaccount.com" --role "roles/cloudfunctions.invoker" --project "project_id"
Run Code Online (Sandbox Code Playgroud)

我的openapi-functions.yaml

swagger: '2.0'
info:
  title: Cloud Endpoints + GCF
  description: Sample API on Cloud Endpoints with a Google Cloud Functions backend
  version: 1.0.0
host: HOST
x-google-endpoints:
- name: "HOST"
  allowCors: "true
schemes:
  - https
produces:
  - application/json …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform

8
推荐指数
2
解决办法
3万
查看次数

标签 统计

google-cloud-platform ×1