serverless / serverless-google-cloudfunctions

Serverless Google Cloud Functions Plugin – Adds Google Cloud Functions support to the Serverless Framework
https://www.serverless.com
MIT License
271 stars 126 forks source link

VPC Connector throws error during deployment #277

Open JonasLaux opened 3 years ago

JonasLaux commented 3 years ago

Hey,

we're currently trying to attach onto our Cloud Functions our Memorystore. Therefor we need a VPC-Connector. In the plain gcloud CLI this would look something like this: gcloud functions deploy myFunction --vpc-connector myVPCConnector

To accomplish this, we could not find anything in the documentation, though found some tests here that had this functionality. So we added our vpc connector in our yaml file to our function, but we only get the following error during "sls deploy":

{ "ResourceType":"gcp-types/cloudfunctions-v1:projects.locations.functions", "ResourceErrorCode":"400", "ResourceErrorMessage":{ "code":400, "message":"The request has errors", "status":"INVALID_ARGUMENT", "details":[ { "@type":"type.googleapis.com/google.rpc.BadRequest", "fieldViolations":[ { "field":"vpc_connector", "description":"A Cloud Function and a Serverless VPC Access connector must be located in the same region." } ] } ], "statusMessage":"Bad Request", "requestPath":"https://cloudfunctions.googleapis.com/v1/projectsmyGCPProject/locations/europe-west1/functions/myFunction", "httpMethod":"PATCH" } } Though the VPC connector and the function are in the same region. Also, if i add it manually via the Cloud Console web interface it works (but ofc after redeployment, this change is gone)

vkislichenko commented 2 years ago

@JonasLaux vpc property does work for me, but I referenced different test

feels like when full path is provided _'projects/PROJECT_ID/locations/us-central1/connectors/CONNECTORNAME' - google handles it as "custom" connector and with only _CONNECTORNAME - it acts as "select existing one"