MongoDB.live, free & fully virtual. Register Now MongoDB.live, free & fully virtual. Register Now

GCP connection error

I’m using golang and mongo-go-driver
I’m pretty confident that the code has no problem for it is pretty simple test example.
but suspecting something could be done with connection url here:

client, err := mongo.NewClient(options.Client().ApplyURI(“mongodb+srv://myid:mypwr@testcluster-pri.ubx7y.mongodb.net/Databases?retryWrites=true&w=majority”))

I’ve got peer connection between GCP VPC to Atlas.
have 0.0.0.0/0 for IP access list.
but I’m getting

server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: firstcluster-shard-00-00-pri.ubx7y.mongodb.net:27017, Type: Unknown, Average RTT: 0, Last error: connection() error occured during connection handshake: dial tcp 192.168.208.2:27017: i/o timeout }, { Addr: firstcluster-shard-00-01-pri.ubx7y.mongodb.net:27017, Type: Unknown, Average RTT: 0, Last error: connection() error occured during connection handshake: dial tcp 192.168.208.3:27017: i/o timeout }, { Addr: firstcluster-shard-00-02-pri.ubx7y.mongodb.net:27017, Type: Unknown, Average RTT: 0, Last error: connection() error occured during connection handshake: dial tcp 192.168.208.4:27017: i/o timeout }, ] }

I have no idea what causes the problem…

Hi @_Toby_Kim,

Welcome to MongoDB community!

The connection string you are using is for Private network peering
https://docs.atlas.mongodb.com/security-vpc-peering/

Have you established one with your gcp host who runs and use it? The 0.0.0.0 whitelist won’t work with this connection string and you need to use a standard connection from connect tab.

Best
Pavel