[GODRIVER-1204] Cannot connect to MongoDB Atlas M0 sandbox Created: 24/Jul/19 Updated: 27/Oct/23 Resolved: 05/Aug/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Junbai Hou | Assignee: | Emmanuel Eppinger (Inactive) |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Atlas:M0 Sandbox, ver 4.0.10 |
||
| Attachments: |
|
| Description |
|
The code snippet below didn't work
|
| Comments |
| Comment by Emmanuel Eppinger (Inactive) [ 05/Aug/19 ] | |||||||
|
No problem. Glad you figured it out!!! | |||||||
| Comment by Junbai Hou [ 05/Aug/19 ] | |||||||
|
Hi Emmanuel,
Thank you so much for the suggestion! I just realized that I didn't add the ip address of my ec2 instance to the atlas ip whitelist. It works now! Sorry for this misleading bug report.
Best, Junbai
| |||||||
| Comment by Emmanuel Eppinger (Inactive) [ 05/Aug/19 ] | |||||||
|
Hey Junbai,
I think this might be either an issue with atlas or maybe the ec2 instance itself. Would you be able to reproduce the issue on another driver?
Heres some example python3 [pymongo|https://api.mongodb.com/python/current/] to try. If it works then that would suggest that this is indeed a bug with the go driver, if not then it might suggest that the issue is with your ec2 instance or atlas.
Also you should try to ping with netcat with TCP the ip address + port of your atlas cluster from your ec2 instance to see if that fails. If it fails that would suggest that there is some type of permissioning issue with your ec2 instance.
Thanks and let us know what happens Emmanuel
| |||||||
| Comment by Junbai Hou [ 02/Aug/19 ] | |||||||
|
It still doesn't work on the ec2 instance after I changed the code accordingly. The initial client.connect() succeeds, but any following client.Ping() or readwrite operations would result in the error. | |||||||
| Comment by Emmanuel Eppinger (Inactive) [ 02/Aug/19 ] | |||||||
|
Hi Junbai,
I tried it even with your uri and it worked totally fine for me. Do you still get the issue if you remove the ?retryWrites=true&w=majority from the uri and add .SetRetryWrites(true).SetWriteConcern(writeconcern.New(writeconcern.WMajority())) to the client options.
Thanks Emmanuel | |||||||
| Comment by Junbai Hou [ 01/Aug/19 ] | |||||||
|
Hi Emmanuel, The uri is
Thank you, Junbai | |||||||
| Comment by Emmanuel Eppinger (Inactive) [ 01/Aug/19 ] | |||||||
|
Hi Junbai,
Would you be able to give us a reproduction connecting without your login credentials?
Thanks, Emmanuel | |||||||
| Comment by Junbai Hou [ 25/Jul/19 ] | |||||||
|
It turned out that the code works on my windows environment, but not on the ec2 instance. |