google-cloud-platform - 使用 Cloudrun 为 ENDPOINTS_SERVICE_NAME 环境变量接收 Google Cloud Endpoints 错误
问题描述
使用 ESPv2 Beta sidecar 容器设置后端服务后收到以下错误消息。
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
它似乎没有变量。
解决方案
像这样更新部署 Cloud Endpoint 的 Cloud Run 环境变量
gcloud beta run services update <SERVICE NAME> \
--set-env-vars ENDPOINTS_SERVICE_NAME=<SERVICE NAME>-<hash>-<REGION>.a.run.app \
--region <REGION> --platform managed
更多细节在我的文章中
推荐阅读
- java - 从 mysql 检索图像并在 JSP 上显示
- python - Python-在Tkinter中的同一帧中绘制多个图
- javascript - 如何在td内画圆?
- c# - WPF DataGrid 不会触发任何事件
- react-native - 如何在 react-native 中重定向文件路径
- java - 如何解决 ViewModel 的“尝试调用虚拟方法”
- python - 尝试使用 PIL 生成随机图片,但得到奇怪的结果
- python - ModuleNotFoundError:没有名为“flask_sqlalchemy”的模块
- java - 获取“不兼容的魔法值”错误 Java
- regex - 正则表达式 - 查找和替换变得过于贪婪