2

I'm trying to use GCP API Gateway to create a single endpoint for a couple of my backend services (A,B,C,D), each with their own path structure. I have the Gateway configured for one of the services as follows:

swagger: '2.0'
info:
  title: <TITLE>
  description: <DESC>
  version: 1.0.0
schemes:
  - https
produces:
  - application/json
paths:
  /service_a/match/{id_}:
    get:
      summary: <SUMMARY>
      description: <DESC>
      operationId: match_id_
      parameters:
        - required: true
          type: string
          name: id_
          in: path
        - required: true
          type: boolean
          default: false
          name: bool_first
          in: query
        - required: false
          type: boolean
          default: false
          name: bool_Second
          in: query
      x-google-backend:
        address: <cloud_run_url>/match/{id_}
        deadline: 60.0
      responses:
        '200':
          description: Successful Response
        '422':
          description: Validation 

This deploys just fine. But when I hit the endpoint gateway_url/service_a/match/123, it gets routed to cloud_run_url/match/%7Bid_%7D?id_=123 instead of cloud_run_url/match/123.

How can I fix this?

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37
Nissan
  • 466
  • 1
  • 4
  • 12

1 Answers1

0

Editing my answer as I misunderstood the issue.

It seems like the { are getting leaked from your configuration as ASCII code, so when you call

x-google-backend:
        address: <cloud_run_url>/match/{id_}
        deadline: 60.0

it doesn't show the correct ID.

So this should be a leak issue from your yaml file and you can approach this the same way as in this thread about using path params

Farid Shumbar
  • 1,360
  • 3
  • 10