mongodbgo

net/http TLS handshake timeout when importing mongo driver golang


Receiving net/http TLS handshake timeout error while importing the official mongo db driver for golang.

go get go.mongodb.org/mongo-driver/mongo

I get the following response

go: found go.mongodb.org/mongo-driver/mongo in go.mongodb.org/mongo-driver v1.3.3
go: downloading github.com/klauspost/compress v1.9.5
../pkg/mod/go.mongodb.org/mongo-driver@v1.3.3/x/mongo/driver/compression.go:16:2: github.com/klauspost/compress@v1.9.5: Get "https://storage.googleapis.com/proxy-golang-org-prod/6d1974c4504adb60-github.com:klauspost:compress-v1.9.5.zip?Expires=1589817362&GoogleAccessId=gcs-urlsigner-prod%40golang-modproxy.iam.gserviceaccount.com&Signature=srzNvLvGM%2BKbAJhtmgjaHE6IjyZLy5JZAQNIgN3oVQis5BEsetWpzu0uPqoxb0bqounoXFKV0COgkR0J%2FjcTenPcihBp0WiZua%2FrHvoLIGRRUgDxPJPs3gniTu2bxqf4aj4BfkTOTH9Hez9QKevGcVGSzkMsB9KsNMbcjnNN2uVJcgfUC4b29xZpEYhXt2mGXqMnU3jflnyRUkK9QDzPArOgbVjZp9bO0RQIs%2BMhiMt822NoZBhOdXCFhrtNie89SQJpELJAIC5r7P8pezU8pUJeQgugXfpgYBmtiH1H5Cvf9xh7v2Bfd3I96wSfUWkrCtceFfG5Xe6CSVmhPjFoeQ%3D%3D": net/http: TLS handshake timeout

I could import other golang libraries just fine. How can I solve this?


Solution

  • The error you're getting shows go get proxying through:

    https://storage.googleapis.com/proxy-golang-org-prod/...
    

    and that proxy connection is timing out.

    So try disabling proxying. You can do this, temporarily, on a per-request basis like so:

    GOPROXY="direct" go get go.mongodb.org/mongo-driver/mongo