Cannot establish connection to remote mongodb

I need to run go test which will initialize a connection to a remote mongodb server. But it will always fail even tho it’s running fine in my local machine

2020/12/22 16:52:06 Failed to create Mongo Client: error parsing uri: lookup *** on cannot unmarshal DNS message