【发布时间】:2020-09-10 11:26:54
【问题描述】:
我正在尝试在 gcp cloud run 上运行 gRPC 演示服务。我遵循了 Google 官方文档。
https://cloud.google.com/endpoints/docs/grpc/get-started-cloud-run
按照本教程中的步骤进行操作后,我已经成功地在我的 gcp 项目上部署了云运行服务。之后,我向服务的端点发送了请求,但请求没有到达服务。我在 google Stackdriver 中找不到访问日志。
python3 bookstore_client.py --host xx-xxxxx-ew.a.run.app --port 443 --use_tls true
设置 ENDPOINTS_SERVICE_NAME 环境变量(不是官方 google 文档的一部分)后,我能够针对服务发送请求。
目前我收到以下错误:
收到状态为 413 的 http2 标头
这意味着有效载荷很大。
整个错误是:
Traceback (most recent call last):
File "bookstore_client.py", line 64, in <module>
run(args.host, args.port, args.api_key, args.auth_token, args.timeout, args.use_tls)
File "bookstore_client.py", line 41, in run
shelves = stub.ListShelves(empty_pb2.Empty(), timeout, metadata=metadata)
File "/opt/Anaconda3-5.1.0-Linux-x86_64/envs/_banned_objects/lib/python3.6/site-packages/grpc/_channel.py", line 826, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/opt/Anaconda3-5.1.0-Linux-x86_64/envs/_banned_objects/lib/python3.6/site-packages/grpc/_channel.py", line 729, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.CANCELLED
details = "Received http2 header with status: 413"
debug_error_string = "{"created":"@1589980909.573607403","description":"Received http2 :status header with non-200 OK status","file":"src/core/ext/filters/http/client/http_client_filter.cc","file_line":121,"grpc_message":"Received http2 header with status: 413","grpc_status":1,"value":"413"}"
该服务的最大内存大小为 2 GB,并且使用一个 CPU 运行。 该请求是教程中的正常请求。 我错过了什么?
【问题讨论】:
-
KalanyuZ 提供的建议是否解决了您的问题,还是您仍然面临问题?
-
您是否使用云端点?从您的问题/标签中不清楚这部分。
标签: python-3.x google-cloud-platform grpc google-cloud-run