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

Go 1.11 LookupSRV cannot unmarshal DNS message

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 0.3.0
    • Component/s: Connections
    • None
    • Environment:
      go1.11.5
      go1.10.8

      Connecting to MongoDB using connection URI SRV in Go v1.11 generates an error: cannot unmarshal DNS message.

      The following code works in Go v1.10 but not in Go v1.11:

              mongoURI := "mongodb+srv://USER:PWD@ts-cluster-ci22a.mongodb.net/test?ssl=true&retryWrites=true"
              client, err := mongo.NewClient(mongoURI)
              if err != nil {
                      log.Fatal(err)
              }
              err = client.Connect(context.TODO())
              if err != nil {
                      log.Fatal(err)
              }
      

      Also, the same code above works with non-SRV URI in Go v1.11.

      This looks to be related to the change in the net package: https://github.com/golang/go/issues/10622

      The call below would work in Go v1.10 but failed in Go v1.11:

              _, _, err := net.LookupSRV("mongodb", "tcp", "ts-cluster-ci22a.mongodb.net")
              if err != nil {
                  log.Fatal(err)
              }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            wan.bachtiar@mongodb.com Wan Bachtiar
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: