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

Querying Atlas sandbox cluster returns server selection timeout

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 0.3.0, 0.2.0
    • Component/s: Connections
    • Labels:
      None
    • Environment:
      Atlas Sandbox replica cluster with 3 nodes, deployed on AWS M0 instances, Version 4.0.6

      I'm able to connect to an Atlas-hosted sandbox replica set cluster, but running any subsequent query (e.g. drop collection) is returning the following error:

      Database connection established
      panic: server selection error: server selection timeout
      current topology: Type: ReplicaSetNoPrimary
      Servers:
      Addr: <address0>, Type: Unknown, State: Connected, Avergage RTT: 0, Last error: x509: certificate signed by unknown authority
      Addr: <address1>, Type: Unknown, State: Connected, Avergage RTT: 0, Last error: x509: certificate signed by unknown authority
      Addr: <address2>, Type: Unknown, State: Connected, Avergage RTT: 0, Last error: x509: certificate signed by unknown authority
      

      The code I'm using to connect is this:

      package main
      
      import (
          "fmt"
          "github.com/mongodb/mongo-go-driver/mongo"
          "context"
      )
      
      func main() {
          client, err := mongo.NewClient("<srv-connection-string>")
          if err != nil {
              panic(err)
          }
          if err := client.Connect(context.Background()); err != nil {
              panic(err)
          }
          db := client.Database("test")
          fmt.Println("Database connection established")
          if err := db.Collection("messages").Drop(context.Background()); err != nil {
              panic(err)
          }
      }
      

      Connecting via Python works:

      >>> import pymongo
      >>> client = pymongo.MongoClient("<srv-connection-string>")
      >>> db = client.test
      >>> print(db.messages.insert_one({"a": 1}))
      <pymongo.results.InsertOneResult object at 0x107fe22c8>
      >>> db.messages.find_one()
      {'_id': ObjectId('5c6aec3224444fbd3fa43121'), 'a': 1} 
      >>> print(db.messages.drop())
      None
      >>> print(db.messages.find_one())
      None
      

       

       

            Assignee:
            scott.lhommedieu@mongodb.com Scott L'Hommedieu (Inactive)
            Reporter:
            junaid.warwani@commonbond.co Junaid Warwani
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: