serverless-google-cloudfunctions icon indicating copy to clipboard operation
serverless-google-cloudfunctions copied to clipboard

VPC Connector throws error during deployment

Open JonasLaux opened this issue 4 years ago • 1 comments

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)

JonasLaux avatar Sep 28 '21 15:09 JonasLaux

@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/CONNECTOR_NAME' - google handles it as "custom" connector and with only CONNECTOR_NAME - it acts as "select existing one"

vkislichenko avatar Apr 27 '22 12:04 vkislichenko