0
votes

I am trying to run a gRPC demo service on gcp cloud run. I followed the official google documentation.

https://cloud.google.com/endpoints/docs/grpc/get-started-cloud-run

After following the steps in this tutorial I have managed it to deploy a cloud run service on my gcp project. After that I have sent request against the endpoint of the service, but the requests didn't reach the service. I found no access logs in google Stackdriver.

python3 bookstore_client.py --host xx-xxxxx-ew.a.run.app --port 443 --use_tls true

After setting the ENDPOINTS_SERVICE_NAME env variable (not part of the official google doc), I was able to send requests against the service.

At the moment I get the following error: "Received http2 header with status: 413" which means that the payload is to large.

Whole error is:

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"}"

The service has a maximum memory size of 2 GB and is running with one CPU. The request is the normal request from the tutorial. So, what am i missing ?

Hope for help, thanks

best wishes Joern

1
did the suggestion provided by KalanyuZ solved your issue or are you still facing problems?Daniel Ocando
Are you using Cloud Endpoints or not? That part’s not clear from your question/tags.Ahmet Alp Balkan

1 Answers

0
votes

I was having the same issue but mine was nodejs implementation. Could it be that in the bullet point #2 of the Configuring Endpoints where you have to configure the api_config.yaml as below:

# The configuration schema is defined by the service.proto file.
# https://github.com/googleapis/googleapis/blob/master/google/api/service.proto

type: google.api.Service
config_version: 3
name: CLOUD_RUN_HOSTNAME
title: Cloud Endpoints + Cloud Run gRPC
apis:
  - name: endpoints.examples.bookstore.Bookstore
usage:
  rules:
  # ListShelves methods can be called without an API Key.
  - selector: endpoints.examples.bookstore.Bookstore.ListShelves
    allow_unregistered_calls: true
backend:
  rules:
    - selector: "*"
      address: grpcs://python-grpc-bookstore-server-HASH-uc.a.run.app

That you were using the CLOUD_RUN_HOSTNAME or even incorrect cloud run service name for the grpcs://python-grpc-bookstore-server-HASH-uc.a.run.app?

I was using the wrong name and when I changed that and redeploy the service it works as expected.