收到 Google Cloud Endpoint with Cloudrun for ENDPOINTS_SERVICE



在使用 ESPv2 Beta 挎斗容器设置后端服务后收到以下错误消息。

Serverless ESPv2 expects ENDPOINTS_SERVICE_NAME in environment variables.
Did you forget to build the Endpoints service configuration
into the ESPv2 image? Please refer to the official serverless
quickstart tutorials (below) for more information.
https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-run#configure_esp
https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-functions#configure_esp
If you are following along with these tutorials but have not
reached the step above yet, this error is expected. Feel free
to temporarily disregard this error message.
If you wish to skip this step, please specify the name of the
service in the ENDPOINTS_SERVICE_NAME environment variable.
Note this deployment mode is **not** officially supported.
It is recommended that you follow the tutorials linked above.

看起来我能够正确设置云运行服务,能够直接从 API 获取响应。

查看gcloud_build_image它似乎没有变量。

https://github.com/GoogleCloudPlatform/esp-v2/blob/9a5a03d439867b0d5563081ac574e94d51922c32/docker/serverless/gcloud_build_image#L53

更新云运行环境变量 部署的位置 像这样部署云终结点

gcloud beta run services update <SERVICE NAME> 
--set-env-vars ENDPOINTS_SERVICE_NAME=<SERVICE NAME>-<hash>-<REGION>.a.run.app 
--region <REGION> --platform managed

更多细节在我的文章中

最新更新