Geoffrey_S
(Geoffrey Sautreau)
November 24, 2023, 4:02pm
1
INFORMATION
Relevant information to this issue:
OS: Mac
databases: MongoDB
Programming language and version: Mongo 6.0
Link to your application : Qovery
ISSUE
I can’t connect to the database
I try to connect with mongosh but it failed with error The --host argument contains an invalid character: ?
HOW TO REPRODUCE
I go on my Qovery service and copy connection string:
It’s
xxxx:xxxxxxxx@zebxxxx-mongodb.zxxxxx.heapstack.sh:27017
Then I enter the following command:
mongosh --host "zebxxxx-mongodb.xxxxxx.heapstack.sh:27017?ssl_ca_certs=rds-combined-ca-bundle.pem" --username "root" --password "xxxx"
What am I missing?
The string connection has missing mongodb://
at least
bchastanier
(Benjamin Chastanier)
November 24, 2023, 4:17pm
2
Hey @Geoffrey_S !
Not a Mongo expert here but given the error message, I think you are not supposed to pass ?ssl_ca_certs=rds-combined-ca-bundle.pem
to the host. Can you try to use the CLI flag instead? --tlsCertificateKeyFile
https://www.mongodb.com/docs/mongodb-shell/reference/options/#std-option-mongosh.--tlsCertificateKeyFile
Also from documentation I am not sure you need to specify mongodb://
Let me know !
Geoffrey_S
(Geoffrey Sautreau)
November 24, 2023, 4:24pm
3
bchastanier:
--tlsCertificateKeyFile
Thank you for your answer.
I used tlsCertificateKeyFile like this
mongosh --host "zexxxxx-mongodb.xxxxx.heapstack.sh:27017" --username "root" --password "xxxxxx" --tlsCertificateKeyFile "rds-combined-ca-bundle.pem"
Now I just have the following message:
MongoNetworkError: connect ECONNREFUSED 35.180.123.39:27017
I suppose the connection string is not a public one. How can access remotely to a mongodb container db ?
bchastanier
(Benjamin Chastanier)
November 24, 2023, 4:30pm
4
Indeed, your container is private so you cannot reach it from the outside.
What you can do is connect to a pod in your cluster, or to an app in your cluster using Qovery shell and connect to the mongo from here.