Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection Error. uri parser problem? #175

Open
haoyun opened this issue Mar 11, 2022 · 1 comment
Open

Connection Error. uri parser problem? #175

haoyun opened this issue Mar 11, 2022 · 1 comment

Comments

@haoyun
Copy link

haoyun commented Mar 11, 2022

In the New Connection modal,

mongodb://username:password@mongo:27017

gives me

server selection error: server selection timeout, current topology: {
Type: ReplicaSetNoPrimary,
Servers: [{ 
  Addr: localhost:27017, 
  Type: Unknown, 
  Last error: connection() error occured during connection handshake: dial tcp [::1]:27017: connect: connection refused
},]
}

The host in the error message is clearly incorrect.

However,

mongodb://username:password@mongo:2701

gives

server selection error: server selection timeout, current topology: { 
Type: Unknown, 
Servers: [{ 
  Addr: mongo:2701,
  Type: Unknown, 
  Last error: connection() error occured during connection handshake: dial tcp 10.88.2.4:2701: connect: connection refused 
}, ] 
}

This time the host is correct, but that's not the address I need.

I tried

mongodb://username:[email protected]:27017

The error message is the same as the first one.

BTW, I am running mongood and mongo via docker-compose. I can confirm that the hostname mongo (corresponds to IP 10.88.2.4) can be resolved from the mongood container.

Moreover, from the devtools in the browser, I can see that the payload send to http://localhost:3000/api/runCommand?d=admin&c=ping is always correct.

@haoyun
Copy link
Author

haoyun commented Mar 11, 2022

I solve this problem by passing in the following address:

mongodb://username:password@mongo:27017?directConnection=true&serverSelectionTimeoutMS=2000

as pointed out here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant