serverless-google-cloudfunctions
serverless-google-cloudfunctions copied to clipboard
Way to configure proper http path to Google Cloud Functions
This is a Bug Report
Description
I have the following config in my .yml:
getArticles:
handler: getAllArticles
events:
- http: articles/all
However after the successful deployment Serverless creates the following endpoint for me: "https://.cloudfunctions.net/getAllArticles" when I want it to be "https://.cloudfunctions.net/articles/all"
Why do the values from config get ignored and it makes the http path equal to handler name?
Additional Data
Serverless.js 1.26.0 Max OS X 10.13.2
Any updates on supporting this?
Seems to me it is a non overridable behaviour of gcloud. Do you succeed in doing this without serverless ?
I believe a good way to solve this issue is to make all API management through Cloud Endpoints. Find more info on how to do a basic setup here: https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-functions
In short, you'd be able to do something like:
paths:
/foo/bar/hello:
get:
summary: Greet a user
operationId: hello
x-google-backend:
address: https://REGION-FUNCTIONS_PROJECT_ID.cloudfunctions.net/helloFunctionName
protocol: h2
responses:
'200':
description: A successful response
schema:
type: string
With this, I was able to map the generated path names to whatever paths I wanted to on Cloud Endpoints.