Added a public domain to MongoDB but I can't connect.

djulianPRO

a month ago

Hi!

When I created a MongoDB instance, I directly removed the public network domain to prevent prodding at it and it being discoverable.

I now need to run a migration script so I wanted to quickly add a public domain to make it easier. But the instance remain inaccessible both using a direct domain proxying 27017 or another proxy (through proxy.rlwy.net).

It remains inaccessible using Compass, mongo CLI and the Railway data tab. I've tried redeploying the project multiple times but nothing does.

The error message is:
connection <monitor> to 35.213.168.149:27017 closed

Looks like the request timeout. What's weird though is if you try to access the domain over HTTP like serviceXXXX.up.railway.app the requests resolve with:
It looks like you are trying to access MongoDB over HTTP on the native driver port.

I guess I could just setup a quick proxy service to proxy the internal domain name and it would work but I consider this a bug I guess?

To reproduce:
1. Create a mongoDB database using native railway database
2. Remove the public domain
3. Add a public domain
4. Service is inaccessible over that domain

Solved

8 Replies

a month ago

Can you try adding and removing the domain again?


Status changed to Awaiting User Response railway[bot] about 1 month ago


djulianPRO

a month ago

I've wrote an answer but everytime I try to publish it I get a fr**king 403 ?? Tried clearing cache / incognito but nothing does?

So since I can't post a detailed answer: still not working

Attachments


Status changed to Awaiting Railway Response railway[bot] about 1 month ago


djulianPRO

a month ago

Also I've noticed some sort of memory leak. This graph is from a mongodb instance that's on a private network. It has a a single persistent mongo connection from my NestJS server through mongoose. It's mostly idle. The drop you see is from a simple service restart. The CPU graph is completetely consistent, no spikes or anything, only the memory is impacted.

Should I make another post about this?

Attachments


a month ago

Oh, it appears that you are trying to connect via HTTP, you need to use a TCP domain for Mongo.


Status changed to Awaiting User Response railway[bot] about 1 month ago


djulianPRO

a month ago

No I'm trying to connect using native mongo through CLI or Compass.

Attachments


Status changed to Awaiting Railway Response railway[bot] 29 days ago


a month ago

Hello,

You are indeed trying to connect to your database via an HTTPS only domain.

You would need to remove that *.up.railway.app domain, and then add a TCP Proxy, once you add the TCP Proxy you have to redeploy the database, and only then will you be able to connect to the database locally.

Best,

Brody


Status changed to Awaiting User Response railway[bot] 29 days ago


Status changed to Solved djulian 29 days ago


djulianPRO

a month ago

It worked. Steps to make it work:
1. Remove the public domain
2. Add a TCP Proxy to 27017 (mongo port)
3. Redeploy the database

  1. Connect using the proxy domain with the provided port: `mongodb://username:*****@xxxxx.proxy.rlwy.net:12345/collection?authSource=admin`


Status changed to Awaiting Railway Response railway[bot] 29 days ago


echohackEMPLOYEE

a month ago

Glad you were able to get tcp proxy to work for you! Thanks for the steps to reproduce.


Status changed to Awaiting User Response railway[bot] 28 days ago


Status changed to Solved echohack 28 days ago


Added a public domain to MongoDB but I can't connect. - Railway Help Station