Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1208

Connect to MongoDB Atlas Sandbox M0 instance

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Connections
    • None
    • Environment:
      Ubuntu 18.04 (DigitalOcean)

      Hello,

      I am trying to connect a sample go app hosted on a DigitalOcean droplet to a MongoDB sandbox instance. This works fine locally. I build the app using Docker. 

      I am using the connection method listed at link [https://docs.atlas.mongodb.com/driver-connection/#driver-examples]

      ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
      defer cancel()
      client, err := mongo.Connect(ctx, options.Client().ApplyURI(
         "mongodb+srv://<username>:<password>@<cluster-address>/test?w=majority",
      ))
      if err != nil { log.Fatal(err) }
      

      I am getting the following error on application startup:

      2019/07/28 20:04:05 server selection error: server selection timeout
      current topology: Type: ReplicaSetNoPrimary
      Servers:
      Addr: rapi0-shard-00-01-yqd60.mongodb.net:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : x509: certificate signed by unknown authority
      Addr: rapi0-shard-00-02-yqd60.mongodb.net:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : x509: certificate signed by unknown authority
      Addr: rapi0-shard-00-00-yqd60.mongodb.net:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : x509: certificate signed by unknown authority
      

      Looks like it is SSL related. I am confused as to why I don't need to specify any ssl specify configuration when I run my code locally, but I do when I run it remotely on digital ocean. 

       

      Please let me know if you need any more info. 

      I have already looked at the related issue link GODRIVER-835, but not sure how to fix it on my end. 

            Assignee:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Reporter:
            labianca.alex@gmail.com Alexander La Bianca
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: