0

I couldnt find example in documentation. I work with API Gateway from GCP to use it for Cloud Functions/Cloud Run etc, all are part of GCP infra.

But now I want to have external URL

I know they are respecting x-google-backend so I tried to 'cheat':

swagger: "2.0"
info:
  title: migration-api
  description: API for migration sql
  version: 1.2.3
schemes:
  - https
consumes:
  - application/json
produces:
  - application/json
basePath:
  /api/track
paths:
  /track:
    post:
      operationId: track
      x-google-backend:
        address: https://notgoogle.com/
        path_translation: CONSTANT_ADDRESS
      responses:
        200:
          description: Success

But it does not work. I tried few other ways but without success Current error

<Error>
<Code>
InvalidArgument
</Code>
<Message>
Invalid argument.
</Message>
<Details>
POST object expects Content-Type multipart/form-data
</Details>
</Error>

Ofc request is made with content type of json. So I suspect that maybe x-google-backend is doing something here under it. But I don't know if there's other way to tell endpoint to call some another service outside of GCP

Nickname0222022022
  • 577
  • 1
  • 4
  • 22
  • Does The same request work when you query your notgoogle endpoint directly? – guillaume blaquiere Jul 20 '23 at 07:46
  • Omitting API gateway? Yeah – Nickname0222022022 Jul 20 '23 at 08:12
  • Have a look at this [Stackoverflow Link](https://stackoverflow.com/a/58754310/18265702). It is suggested to run an [Extensible Service Proxy](https://github.com/cloudendpoints/esp) in front of your non-GCP backend service so that Cloud Endpoints can proxy requests to it. – Sandeep Vokkareni Jul 20 '23 at 11:26
  • Along with above suggestions, check with this [Stackoverflow link](https://stackoverflow.com/q/70386128/18265702) where you can give `consumes` inside the post content and as per the error the post requires a content to be provided but you haven't sent any you can pass that with a file example - give a schema like [this](https://codefile.io/f/57r7s91KWG). And as you mentioned `I know they are respecting x-google-backend so I tried to 'cheat':` Though your syntax is correct but as per Api gatway this url should be part of google domain. – Sandeep Vokkareni Jul 25 '23 at 07:45

0 Answers0