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?

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

3 Comments

This does not answer my question. The answer is completely off topic.
@Nissan my apologies for misunderstanding. Please have a look at the edited answer and let me know if it helps you.
@Nissan, How did you resolved this.? I am also facing the same issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.