4 months 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
Connecting to MongoDB using URI: mongodb+srv://<username omitted>:<password omitted>cluster0.htrpa.mongodb.net/BCCData?retryWrites=true&w=majority&appName=Cluster0
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)
Server running on http://localhost:8080
1 Replies
4 months 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 • 4 months ago