gRPC errors with "GET request without QUERY" when requested through ESPv2

689 views
Skip to first unread message

Wenzhe Gao

unread,
Jan 18, 2021, 5:25:54 PM1/18/21
to Google Cloud Endpoints
Hello,

I have a problem sending a request to a local gRPC server from Extensible Service Proxy v2. The gRPC server works when requested via GRPC UI, but when requested though ESP, the request is not processed, and the gRPC server prints error:

E1123 21:13:45.264632366       9 http_server_filter.cc:299]  GET request without QUERY

All I know is that this is related to base64 padding (https://github.com/grpc/grpc/commit/ce0fd978e1f93a54d97d882562e9d47487b34ef0 and https://medium.com/better-software/interface-grpc-with-web-using-grpc-web-and-envoy-possibly-the-best-way-forward-3ae9671af67). I'm not even sure if the cause is on the side of the ESP or the gRPC server.

The gRPC server is executed from Python.

The docker-compose.yaml:

=================================================================

version: '3.7'
services:
  grpc:
    image: esptest:latest
    container_name: esptest_grpc
    build:
      context: ./
      dockerfile: ./Dockerfile
    ports:
      - "4000:8080"
    volumes:
      - $GOOGLE_APPLICATION_CREDENTIALS:/usr/local/etc/google-application-credentials.json:ro
    environment:
      - GOOGLE_APPLICATION_CREDENTIALS=/usr/local/etc/google-application-credentials.json
      - GRPC_TRACE=all
      - GRPC_VERBOSITY=DEBUG

  esp:
    image: gcr.io/endpoints-release/endpoints-runtime:2
    container_name: esptest_esp
    ports:
      - "4002:8082"
    volumes:
      - $GOOGLE_APPLICATION_CREDENTIALS:/usr/local/etc/google-application-credentials.json:ro
      - ./api_config.json:/usr/local/etc/api_config.json:ro
    command:
      - "--service_json_path=/usr/local/etc/api_config.json"
      - "--listener_port=8082"
      - "--backend=grpc://grpc:8080"
      - "--backend_dns_lookup_family=v4only"
      - "--cors_preset=basic"
      - "--non_gcp"
      - "--enable_debug"
    environment:
      - GOOGLE_APPLICATION_CREDENTIALS=/usr/local/etc/google-application-credentials.json
    depends_on:
      - grpc

=================================================================

Here is the api_config.json:

=================================================================

{
  "apis": [
    {
      "methods": [
        {
          "name": "Ping",
          "options": [
            {
              "name": "google.api.http",
              "value": {
                "@type": "type.googleapis.com/google.api.HttpRule",
                "get": "/ping"
              }
            }
          ],
          "requestTypeUrl": "type.googleapis.com/esptest.proto.common.Empty",
          "responseTypeUrl": "type.googleapis.com/esptest.proto.common.Empty"
        }
      ],
      "name": "esptest.proto.ping_service.Ping",
      "sourceContext": {
        "fileName": "services/ping_service/ping_service.proto"
      },
      "syntax": "SYNTAX_PROTO3",
      "version": "v1"
    }
  ],
  "authentication": {
    "providers": [
      {
        "audiences": "https://api-dev.example.com",
        "id": "google_id_token",
        "issuer": "https://accounts.google.com"
      }
    ],
    "rules": [
      {
        "requirements": [
          {
            "audiences": "https://api-dev.example.com",
            "providerId": "google_id_token"
          }
        ],
        "selector": "esptest.proto.ping_service.Ping.Ping"
      }
    ]
  },
  "configVersion": 3,
  "control": {
    "environment": "servicecontrol.googleapis.com"
  },
  "endpoints": [
    {
      "name": "api-dev.example.com"
    }
  ],
  "http": {
    "rules": [
      {
        "get": "/ping",
        "selector": "esptest.proto.ping_service.Ping.Ping"
      }
    ]
  },
  "id": "2020-11-23",
  "name": "api-dev.example.com",
  "producerProjectId": "esptest-dev",
  "title": "Endpoints",
  "types": [
    {
      "name": "esptest.proto.common.Empty",
      "sourceContext": {
        "fileName": "services/common/common.proto"
      },
      "syntax": "SYNTAX_PROTO3"
    }
  ],
  "usage": {
    "rules": [
      {
        "allowUnregisteredCalls": true,
        "selector": "esptest.proto.ping_service.Ping.Ping"
      }
    ]
  }
}

Wayne Zhang

unread,
Jan 19, 2021, 3:36:47 PM1/19/21
to Wenzhe Gao, Google Cloud Endpoints
By reading the source code from here,  it seems that GRPC-UI is sending "cacheable" requests with HTTP method `GET` and all request data is in the query parameter.   Unfortunately,  ESPv2 is using Envoy grpc_transcoder, and it does not support HTTP `GET`.  all HTTP requests have to use http method `POST`. 
I don't know GRPC UI,  not sure if you can turn off the "cacheable" feature. 

--
You received this message because you are subscribed to the Google Groups "Google Cloud Endpoints" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-endp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-endpoints/60d04ba8-3e21-495a-a332-7a05c5db2538n%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages