R
Railway5mo ago
badcom

Can't connect to MongoDB via the MongoDB service > Data or via MongoDB Compass

I keep getting the attached error message when I try to connect to MongoDB via the Railway dashboard. If I try to connect via MongoDB Compass the connection times out and it never connects. What am I missing? Project ID: 2c41e4bd-c910-4316-8e83-f0c3b6c63eab
No description
Solution:
mongo listens on 27017 by default, not 27021
Jump to solution
14 Replies
Percy
Percy5mo ago
Project ID: 2c41e4bd-c910-4316-8e83-f0c3b6c63eab
Brody
Brody5mo ago
is the deployment active?
badcom
badcom5mo ago
Yes. My application which is on the same project can access the DB
Brody
Brody5mo ago
try redploying the database
badcom
badcom5mo ago
Same thing =/
Brody
Brody5mo ago
send the deploy logs for mongo please https://bookmarklets.up.railway.app/log-downloader/
badcom
badcom5mo ago
Do I need to expose it somehow?
Brody
Brody5mo ago
is your app connecting to the database via its public url ?
badcom
badcom5mo ago
No. Via the private one
Brody
Brody5mo ago
do you have a tcp proxy on the database?
badcom
badcom5mo ago
Is this what you're referring to?
No description
Solution
Brody
Brody5mo ago
mongo listens on 27017 by default, not 27021
badcom
badcom5mo ago
Yes, that seemed to be the issue. I had to delete the service and recreate it as deleting the TCP proxy and recreating it with the right port wasn't working. Thanks for your help!