I have a running backend server that serves GraphQL on endpoint /api. Works like a charme but I still have it externally open and access is possible without authentication.
So I started trying the API Gateway beta Google just released. All that was pretty straight forward expcept the part where I have to configure the OpenAPI 2.0 configuration YAML.
swagger: "2.0"
info:
title: myapp-backend-graphql-api
description: "API for GraphQL queries and mutations"
version: "1.0.0"
schemes:
- "https"
paths:
"/api":
post:
description: "GraphQL Endpoint"
operationId: "graphqlEndpoint"
x-google-backend:
address: https://myapp-backend-43Jasfasd-ew.a.run.app
parameters:
- in: body
name: GraphQl
schema:
type: object
responses:
200:
description: "Success."
schema:
type: object
So this is my openapi-config.yml. I somewhat struggled a b
it defining the "REST" endpoint here since I have a GraphQL endpoint. But it's just a POST request, right? So nothing usual for OpenAPI 2.0 I thought.
Anyways the API Gateway was created successfully according to GCP

However - calling the API now via the Gateway URL https://mystuff-api-9kytelt5.ew.gateway.dev and the endpoint /api fails.
xetra11@pop-os:~$ curl https://mystuff-api-9kytelt5.ew.gateway.dev/api/schema.json
{"message":"Path does not match any requirement URI template.","code":404}
I am somewhat lost with that error message and don't know where I have to adjust something.
