I have an app in production that has been running for about a year. It's had it's fair share of ups and downs, but I haven't had a problem with it for a while. The Linode server decided to have a physical hardware problem and accidentally killed the whole server and was forced to re-migrate about three times.
Everything is up and running, but now my
node.js app refuses to connect to the mongoDB database.
Like I said, it's ran, been restarted, stopped,
npm install, etc. for a while now, so I know the connection code is solid. The database in question can be connected to via
mongo <ip_address> from the connection IP address.
When I attempt to run the app, I get errors when attempting to connect to the database.
throw new Error('Error connecting to database'); ^ Error: Error connecting to database at module.exports (<path>/node_modules/connect-mongo/lib/connect-mongo.js:115:13)
I've double checked that no programs are running on the port I'm running the application on, everything looks like it should work correctly. I've double checked environment variables to ensure everything is working fine.
I will say that there was a version of
mongodb installed on the server who's database is locked thanks to the server crash, however I have verified that
mongoose isn't attempting to connect to that localhost database.
Is there anything else that I can do to troubleshoot this error?
The only other option I see at this point is to write a small
Express/MongoDB server using the same
npm dependencies to see if I can access the DB from there.
I'm sorry I know this is kind of a vague question, but I'm puzzled why this isn't connecting to a valid database.
IRC isn't much help as it keeps disconnecting me due to internet spikes.
Anyone have ideas?