firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Support for Direct VPC egress for v2 Cloud Functions

Open orestesgaolin opened this issue 8 months ago • 5 comments

[REQUIRED] Environment info

firebase-tools: 14.4.0

Platform: macOS

[REQUIRED] Test case

Try to use Direct VPC egress for v2 cloud functions, e.g.

export const uploadData = onRequest(
    {
        region: "europe-west1",
        memory: "256MiB",
        minInstances: 0,
        timeoutSeconds: 60,
        vpcConnectorEgressSettings: "PRIVATE_RANGES_ONLY",   
    }, async (request, response) => {
        try {

[REQUIRED] Steps to reproduce

  1. Deploy function with the following settings
  2. Go to GCP console to the cloud function v2 details
  3. See that VPC network is not enabled

Image

[REQUIRED] Expected behavior

It should be possible to use Direct VPC access via firebase CLI so that the default VPC network is selected after deploying.

Image

[REQUIRED] Actual behavior

No VPC access from v2 Cloud Function

orestesgaolin avatar May 21 '25 09:05 orestesgaolin

Hi, thanks for raising this, it's been received. We will provide updates when available.

cabljac avatar Jun 05 '25 11:06 cabljac

Reproduced this here

Seems like it's the lines here

cabljac avatar Jun 05 '25 17:06 cabljac

I think there might be a workaround, after deploying you could run:

gcloud run services update uploadData \
  --project=YOUR_PROJECT_ID \
  --region=europe-west1 \
  --network=default \
  --subnet=default \
  --vpc-egress=private-ranges-only

Can you let me know if this workaround works for you?

I will raise the issue with the team though. Thanks for bringing to our attention.

cabljac avatar Jun 05 '25 17:06 cabljac

Yes, I can change the network settings after the deployment via gcloud cli or GCP console. The issue is not super urgent but would be much more convenient to set it via firebase cli or function configuration

orestesgaolin avatar Jun 05 '25 17:06 orestesgaolin

+1 on this. Looking to connect my firebase functions to a memorystore instance

rishabh-rastogi215 avatar Jun 21 '25 12:06 rishabh-rastogi215

+1 on this as well! Having to change the settings every time I deploy is inconvenient. I've decided to use the VPC connector until direct vpc configuration is supported in cloud-functions.

kanehjeong avatar Sep 04 '25 06:09 kanehjeong

This will be really handy

kkane avatar Oct 03 '25 22:10 kkane

Bump.

I'm missing this too.

It would be really nice if we could configure Direct VPC in code, rather than hacking every time with this workaround: https://github.com/firebase/firebase-tools/issues/8633#issuecomment-2945386596

jzarzeckis avatar Nov 01 '25 20:11 jzarzeckis