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

Could not connect to database using connectionString #125

Open
jyanga opened this issue Apr 4, 2024 · 4 comments
Open

Could not connect to database using connectionString #125

jyanga opened this issue Apr 4, 2024 · 4 comments

Comments

@jyanga
Copy link

jyanga commented Apr 4, 2024

Hi,

I have the line below in my docker-compose.yml

- ME_CONFIG_MONGODB_URL=mongodb://${UNAME}:${PASSWORDD}@server1.example.com:27001,server2.example.com:27002,server3.example.com:27003/?replicaSet=mongodb-rs1

This gives me the error below.

 Could not connect to database using connectionString: mongodb://user1:****@server1.example.com:27001,server2.example.com:27002,server3.example.com:27003/?replicaSet=mongodb-rs1"
 /app/node_modules/mongodb/lib/sdam/topology.js:285
                 const timeoutError = new error_1.MongoServerSelectionError(`Server selection timed out after ${serverSelectionTimeoutMS} ms`, this.description);
                                                                                                                                                         ^

 MongoServerSelectionError: getaddrinfo EAI_AGAIN server1

The line below works when I specify it in my docker-compose.yml. However, this will not work if this server is being serviced. I would like to take advantage of the replicaSet.

- ME_CONFIG_MONGODB_URL=mongodb://${RUNAME}:${RPASSWD}@server1.example.com:27001/?directConnection=true

I connect successfully using the command below.

mongosh "mongodb://${UNAME}:${PASSWORDD}@server1.example.com:27001,server2.example.com:27002,server3.example.com:27003/?replicaSet=mongodb-rs1"

Help. I have tried different ways to specify ME_CONFIG_MONGODB_URL.

mongo-express version is 1.0.2-20.

@xTudoS
Copy link

xTudoS commented Jul 17, 2024

Hello! Did you tried to run mongoexpress outside a docker container, and see if the error continues? Or tried to build your own docker image?

Docker hub version is out-of-date

@mariuskempf
Copy link

I am having a very similar issue, where I deploy the image from Docker-Hub to Kubernetes. I keep running into these timeouts while using the CLI or PyMongo, I am able to connect to the replica/server

@jyanga
Copy link
Author

jyanga commented Aug 7, 2024

@xTudoS
Copy link

xTudoS commented Aug 8, 2024

thank you @jyanga
did it work @mariuskempf ?

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

3 participants