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
14 Replies
Project ID:
2c41e4bd-c910-4316-8e83-f0c3b6c63eab
is the deployment active?
Yes. My application which is on the same project can access the DB
try redploying the database
Same thing =/
send the deploy logs for mongo please https://bookmarklets.up.railway.app/log-downloader/
Do I need to expose it somehow?
is your app connecting to the database via its public url ?
No. Via the private one
do you have a tcp proxy on the database?
Is this what you're referring to?
Solution
mongo listens on 27017 by default, not 27021
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!