I’ve followed all the documentation: MongoDB Atlas VPC Peering.
Pre-requisites:
- I’m using an Atlas M10 Cluster.
- The cluster is hosted on Google Cloud in the same region as the App Engine.
- The App Engine is using the FLEXIBLE environment.
- I’m using the default VPC network, which is connected to the App Engine by default. Since I’m using the flexible environment, I don’t need Serverless VPC Access.
The connection status is active on both ends, as shown in the attached images.
I’ve also added the IP ranges 10.128.0.0/9 and 10.0.0.0/8 to the IP Access List.
The Issue:
Whenever I remove 0.0.0.0/0 from the IP Access List, my server can’t reach the MongoDB.
My App Engine uses a Docker image with a NodeJS server, but I don’t think that’s the issue.
I’m using the connection string in the following format: mongodb+srv://user:[email protected], but I saw in the FAQ documentation that I should be targeting the one with “pri”: mongodb+srv://user:[email protected]. When I try to use this locally to see if I receive a 401 error, it keeps loading until it shows a timeout error, so I assume it won’t work in production…
Questions:
- What’s the issue?
- How can I debug this?
The only way I can test it currently is by removing 0.0.0.0/0 from the Access List and adding it back again.
Google Cloud
Mongo Atlas
I’ve tried adding a Serverless VPC connector.
I also created a new VPC instead of using the default one.
I’ve tested different IP addresses for the whitelist.
I created firewall rules.
I have looked at previous questions on Stack Overflow and other MongoDB forums to find what the error might be.
Fran Dugo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.