Following the Getting Started guide for https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-functions to get my Cloud Function behind a CDN. Deployed ESPv2 Beta to Cloud Run and got a provisioned CloudRun Service URL. Now I'm hitting a wall with my openapi-functions.yaml
file. When I run the command:
gcloud endpoints services deploy openapi-functions.yaml \
--project ESP_PROJECT_ID
I get the error response:
ERROR: (gcloud.endpoints.services.deploy) INVALID_ARGUMENT: Cannot convert to service config.
'location: "openapi-functions.yaml: x-google-backend"
kind: ERROR
message: "Extension x-google-backend cannot be converted into proto type google.api.BackendRule. Details: Cannot find field: produces in message google.api.BackendRule"
location: "openapi-functions.yaml: x-google-backend"
kind: ERROR
message: "Address field in extension x-google-backend is not a valid URL"
The openapi-functions.yaml
I'm using seems to be nearly identical to the example in the tutorial and it seems like this error is saying that a Cloud Functions endpoint isn't a valid URL for CloudRun! What am I doing wrong here? Thanks in advance for any help.
openapi-functions.yaml:
swagger: '2.0'
info:
title: "My API"
description: "Returns something"
version: 1.0.0
host: "SERVICENAME-IDENTIFIER-uc.a.run.app"
schemes:
- "https"
produces:
- application/json
paths:
"/foo":
get:
summary: "Returns thing"
operationId: "foo"
x-google-backend:
address: "https://us-central1-my-project-name.cloudfunctions.net/bar"
produces:
- "application/json"
responses:
'200':
description: "OK"
schema:
type: "string"
'404':
description: "Error"
schema:
type: "string"
'403':
description: "Forbidden"
schema:
type: "string"
produces
is over-indented. It should be on the same level asresponses
and not insidex-google-backend
. – Helen