ESPv2 with Google Cloud Endpoints using gRPC returning "The current request is not defined"

508 views Asked by At

I'm trying to get ESPv2 with Cloud Endpoints working to proxy to a service using gRPC. (We've been already extensively using ESPv2 with OpenApi, but this is the first gRPC service we're trying to use it with.)

Here is what I did:
I have a proto contract like this:

syntax = "proto3";

package postsaleapi.v1;

service PostSaleService {
  rpc GetAllProducts (GetAllProductsRequest) returns (GetAllProductsResponse);
}

message GetAllProductsRequest {
  string order_number = 1;
}

message GetAllProductsResponse {
  ...
}

This post_sale_service.proto file is under the path /postsaleapi/v1/ in the repository folder containing our contracts.

Then I've created the compiled proto descriptor with protoc from the root folder of the repo:

protoc --proto_path=. --include_imports --include_source_info --descriptor_set_out=api_descriptor.pb .\postsaleapi\v1\post_sale_service.proto

This seems to have worked correctly, it created the api_descriptor.pb file, and if I do

protoc --decode_raw < api_descriptor.pb

It prints out all the details of the contract.

Then I created the service config file serviceConfig.yaml:

type: google.api.Service
name: postsaleapi-esp.stg.ourcompany.com
apis:
  - name: postsaleapi.v1.PostSaleService
usage:
  rules:
  - selector: postsaleapi.v1.PostSaleService.GetAllProducts
    allow_unregistered_calls: true

(Eventually I'd like to use authentication, but for now I just want to get the ESP working without any auth.)

And created the service with gcloud:

gcloud endpoints services deploy api_descriptor.pb serviceConfig.yaml

It is successfully created.

And I've deployed the ESP, the container has the following setup:

Containers:
  postsaleapi-esp:
    Container ID:  docker://afe7fa3e01fb2575df2a6779c839fdbbf45986f6d54ce90bf2ed9c895382df9b
    Image:         gcr.io/endpoints-release/endpoints-runtime:2.32.0
    Image ID:      docker-pullable://gcr.io/endpoints-release/endpoints-runtime@sha256:dfe8e931e26f7894dc0ba1eecec51423e8f9cec7fe1d5957e717a104423bec57
    Port:          8443/TCP
    Host Port:     0/TCP
    Args:
      --listener_port=8443
      --backend=https://postsaleapi.stg.internal.ourcompany.io:443
      --service=postsaleapi-esp.stg.ourcompany.com
      --service_account_key=/gcp-service-account/service-account-key.json
      --ssl_server_cert_path=/etc/envoy/ssl
      --backend_dns_lookup_family=v4only
      --enable_debug
      --http_request_timeout_s=60
      --rollout_strategy=managed

The underlying gRPC service is accessible at https://postsaleapi.stg.internal.ourcompany.io, and the standalone ESP is being accessed via a LoadBalancer Service.

If I try to call the GetAllProducts gRPC endpoint, I'm getting back this response:

{
  "error": "12 UNIMPLEMENTED: {\"code\":404,\"message\":\"The current request is not defined by this API.\"}"
}

If I check the logs of the ESP container, it prints these lines (among others) when I try testing the endpoint:

D0426 10:36:28.074 44 src/envoy/http/service_control/handler_impl.cc:114] [44][filter]No route entry
D0426 10:36:28.074 44 src/envoy/http/service_control/handler_impl.cc:92] [44][filter]No operation found
D0426 10:36:28.074 44 src/envoy/http/service_control/handler_impl.cc:95] [44][filter]Use non matched requirement.
D0426 10:36:28.074 44 external/envoy/source/common/http/filter_manager.cc:947] [44][http][C4][S10619230553122087859] Sending local reply with details direct_response
D0426 10:36:28.075 44 src/envoy/http/grpc_metadata_scrubber/filter.cc:29] [44][filter]Filter::encodeHeaders is called.
D0426 10:36:28.075 44 external/envoy/source/common/http/conn_manager_impl.cc:1467] [44][http][C4][S10619230553122087859] encoding headers via codec (end_stream=true):\n\':status\', \'200\'\n\'content-type\', \'application/grpc\'\n\'grpc-status\', \'12\'\n\'grpc-message\', \'{\"code\":404,\"message\":\"The current request is not defined by this API.\"}\'\n\'date\', \'Tue, 26 Apr 2022 10:36:28 GMT\'\n\'server\', \'envoy\'\n\'x-envoy-decorator-operation\', \'ingress UnknownOperationName\'

Can anybody tell what might be missing, or how I could troubleshoot further what is going wrong?

0

There are 0 answers