a year ago
Hi everyone,
Just today my app receives some errors in MongoDB connection, below is the log files (I've attached the screenshot, too):
MongoServerSelectionError: getaddrinfo ENOTFOUND mongodb.railway.internal
at Timeout._onTimeout (/app/node_modules/agenda/node_modules/mongodb/lib/sdam/topology.js:292:38)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) {
'mongodb.railway.internal:27017' => ServerDescription {
address: 'mongodb.railway.internal:27017',
It seems that the URL that should have been set for private networking @ mongodb.railway.internal
could not be recognized by my container running in the same project.
This problem seems to happen intermittently though.
Because my services are live already, I had to switch the MongoDB URL to the public one instead (which would cost me egress network costs).
Please let me know if this is a known issue, or if there is anything else that I should do from my side.
As a dev, aside from reasons based on the costs, I would also prefer the usage of private network to access the DB.
In summary: the private URL access for MongoDB seems to be unstable currently, sometimes the request went thru, sometimes it would just result in a timeout.
Thanks a lot!
0 Replies
a year ago
dockerfile or nixpacks based build?
node.js based app, but I didn't build the image myself. I let nixpacks build it.
a year ago
do you have a 3 second sleep in your start script?
a year ago
yes please add a 3 second sleep to the start command so the starting of your app is delayed
Status changed to Solved Railway • over 1 year ago
ah ok I will add it
just a question though: is the 3s sleep relevant to the problem? in my screenshot above, the problem seems to only occur pretty much recently.
the deployed image was running properly for days and it never had problem accessing the MongoDB via internal network
a year ago
yes the private network is not available for the first 3 or so seconds
Also, I browsed around and it looks like I'd need to add this as well in environment variable:
ENABLEALPINEPRIVATE_NETWORKING=true
a year ago
you said you where using nixpacks right? nixpacks is not based on alpine
a year ago
awsome
I even spammed the services and it seems to work fine. access to MongoDB via internal network seems to be stable.
a year ago
happy to hear it