nightscout / nightscout.github.io

website, meta repo for whole project
GNU General Public License v2.0
107 stars 233 forks source link

Unable to Connect To Mongo (Restart resolves only temporarily) #217

Closed janvv closed 1 month ago

janvv commented 1 month ago

Hi there! I use the latest master release: https://github.com/nightscout/cgm-remote-monitor/commit/21e0591d49235845acba58cf8b3cc7339921185b on Northflank. the database is not full (60%). Accessing the mongodb database using mongo db compass is possible.

image

After i restart the service, nightscout works finde but then the same problem repeats. I keep getting this error. I checked the logs and this is what i found:

2024-09-15T01:55:14.565663923Z stdout F Error connecting to MongoDB: {"name":"MongoServerSelectionError","reason":{"type":"ReplicaSetNoPrimary","setName":null,"maxSetVersion":null,"maxElectionId":null,"servers":{},"stale":false,"compatible":true,"compatibilityError":null,"logicalSessionTimeoutMinutes":null,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"commonWireVersion":null}} - retrying in 3 sec
2024-09-15T01:55:14.569661875Z stdout F ERROR CONNECTING TO MONGO Error: MongoDB connection failed! Double check the MONGODB_URI setting in Heroku.
2024-09-15T01:55:14.56967532Z stdout F     at connect_with_retry (/workspace/lib/storage/mongo-storage.js:67:28)

I checked the trouble shooting guidelines but didn't find anything that helped me resolve this issue.

psonnera commented 1 month ago

We've had several reports of this failure mode. I don't really understand it as the database is provided by the same vendor and is located in the same domain. I will add a disclaimer to the documentation.

psonnera commented 1 month ago

@janvv can you confirm the database is in Northflank and not Atlas?

psonnera commented 1 month ago

Closing for inactivity.

janvv commented 3 weeks ago

@psonnera Sorry for the inactivity! Yes, it is Northflank, not Atlas!