5

I'm trying to enable my firebase functions to connect to my mongodb in atlas without allowing all inboud traffic. I've successfully done the peering with mongodb's VPC and the custom vpc I've created.

But no matter what ip range I try the servereless vpc connector ends up in a 'bad state' where I need to delete it. In this bad state, adding the functions to the VPC also fails claiming the connector doesn't exist.

My vpc network, connector, firebase functions are all in europe-west2.

My vpc configuration:

    ranges:  10.0.0.0/9     
    gateway: 10.0.0.1

and one subnet called 'main' with the same settings.

My vpc connector configuration is in the same zone and I've tried various options for ranges such as:

10.64.0.0/28 and the default recommended 10.8.0.0/28 which I've double checked to not be in use already by any other network.

What exactly am i missing from this configuration? I've read several articles and stackoverflow posts + documentation and none of them were clear on how you're supposed to match the two.

Does the vpc network have to have a wider range defined? of which the serverless connector must be part of? but they mention there must be no overlap so that can't be.

SebastianG
  • 8,563
  • 8
  • 47
  • 111
  • I would advise you to follow this [doc](https://cloud.google.com/vpc/docs/configure-serverless-vpc-access#creating_a_connector) in order to create a new VPC. After you can follow this [doc](https://cloud.google.com/functions/docs/networking/connecting-vpc#setting_up_permissions) in order to set up the CF. Then you have to specify the VPC to the CF, for this you can check this [doc](https://cloud.google.com/functions/docs/networking/connecting-vpc#configuring). – Nicholas Jun 11 '20 at 08:31
  • 2
    @chainicko i've actually fixed it by just randomly going into the settings of my existing non-default network, deleted the subnet i initially created, tried to enable DNS and there was a toggle that i can't remember what it was as it doesn't seem to be there anymore... none of this is documented in any of those docs. – SebastianG Jun 11 '20 at 08:43

0 Answers0