mongodb won't connect on deployment but does on local and railway shell
cproffi2
PROOP

a year ago

I am able to connect to my mongodb from a local version of my build on my machine and through railway shell on cli, but it never connects when I deploy it, even though I've whitelisted my static IP and 0.0.0.0

i've gotten the db to connect to other services like heroku and render only using 0.0.0.0, but it's failing on deploy here.

here are the logs where i console.log the keys (and they're correct) omitted

npm warn config production Use --omit=dev instead.

mongo connection logs --

Mongo debug level from env: mongodb*

does this even do anything

electric_plug emoji Connecting to MongoDB using URI: mongodb+srv://<username omitted>:<password omitted>cluster0.htrpa.mongodb.net/BCCData?retryWrites=true&w=majority&appName=Cluster0

x emoji MongoDB Connection Error: Socket 'secureConnect' timed out after 30015ms (connectTimeoutMS: 30000) MongoServerSelectionError: Socket 'secureConnect' timed out after 30015ms (connectTimeoutMS: 30000)

at Topology.selectServer (/app/node_modules/mongodb/lib/sdam/topology.js:321:38)

at async Topology._connect (/app/node_modules/mongodb/lib/sdam/topology.js:200:28)

at async Topology.connect (/app/node_modules/mongodb/lib/sdam/topology.js:152:13)

at async topologyConnect (/app/node_modules/mongodb/lib/mongo_client.js:233:17)

at async MongoClient._connect (/app/node_modules/mongodb/lib/mongo_client.js:246:13)

at async MongoClient.connect (/app/node_modules/mongodb/lib/mongo_client.js:171:13)

at async connectDB (/app/server/index.js:45:9)

at async Server.<anonymous> (/app/server/index.js:96:5)

rocket emoji Server running on http://localhost:8080

Solved

1 Replies

chandrika
EMPLOYEE

a year ago

Hey there, could you check our docs on running with Mongo on Railway https://docs.railway.com/guides/mongodb ?


Status changed to Awaiting User Response Railway 12 months ago


Railway
BOT

7 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 7 months ago


Loading...