piyush garg
piyush garg

Reputation: 71

Google end point gives Invalid HTTP template in logs for GET /

I am using google end points to deploy some of my apis. I am exposing health API on [GET /] which returns http 200 so that GKE ingress can consider my container as healthy by invoking this API.

But when I am invoking this end point using [ip-address/], end point always complains method not exist. This works fine for path [ip-address/hello]

Ask: Should I configure / end point in some different manner.

Below are the starter logs of ESP (GKE extensible service proxy container)

nginx: [warn] Using trusted CA certificates file: /etc/nginx/trusted-ca-certificates.crt
2020/06/02 11:33:13[error]1#1: Invalid HTTP template: /
2020/06/02 11:33:13[error]1#1: Failed to add http rule: selector: "1.abcd_api_endpoints_my_app_cloud_goog.GetHealth"
get: "/"

My open api sepecification yaml

swagger: "2.0"
info:
  title: Dummy API
  description: Dummy API
  version: 1.0.0
host: abcd-api.endpoints.my-app.cloud.goog
consumes:
  - application/json
produces:
  - application/json
schemes:
  - http
paths:
  /:
    get:
      description: Logs service health status
      operationId: getHealth
      responses:
        '200':
          description: Logs service health.
  /hello:
    get:
      description: Returns Hello World
      operationId: helloWorld
      responses:
        '200':
          description: Returns Hello World

Upvotes: 1

Views: 185

Answers (1)

piyush garg
piyush garg

Reputation: 71

After reading through Google end points limitation for esp, I came to know that requests on root path are rejected by esp.

https://cloud.google.com/endpoints/docs/openapi/openapi-limitations#operations_on_url_root_path_

To resolve this problem and providing health end point esp provides --healthz paramter.

https://cloud.google.com/endpoints/docs/openapi/specify-proxy-startup-options

https://github.com/GoogleCloudPlatform/endpoints-samples/blob/master/k8s/esp_echo_gke_ingress.yaml

Upvotes: 2

Related Questions