-
Notifications
You must be signed in to change notification settings - Fork 71.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nightscout crash: "MongoDB connection failed! Double check the MONGODB_URI setting in Heroku" #6775
Comments
Right - would it be possible for you to deploy this branch, so we'll see what the error is. Looks like you're hitting a previously unreported bug and sadly the current build doesn't log the error that's happening. #6777 |
I have deployed the |
Here are the logs of a crash running your
|
I have just deployed the latest and got the same error straight away. |
Dammit, @philipgo can you update to latest in the branch, there were two additional error spots like this, which now also capture the error. Btw how do you host the site? Based on the URL this is your own setup? Which Mongo version do you have? @lukebrogan Same to you - how are you hosting the site? |
Hello! |
@sulkaharo Thank you, Sulka, already deployed. @lukebrogan Your error may not be the same as mine. If your site never works: are you sure your MongoDB_URI is correct? My site works fine for hours or sometimes days, then it crashes. |
Yeah you are right - it was an error in the MongoDB_URI string, all working for me now 👍 |
Here are the logs of another crash running the latest Some googling showed others are seeing similar errors in connection with
|
@philipgo Given the logged error is simply that the connection has failed, I'm assuming this has to be something in your Mongo setup, as this hasn't been reported by others. Not the Mongo Driver in Nightscout has been configured to auto-reconnect and this seems to be also fail in this case. FWIW I have a similar setup in Digital Ocean and have never had the Mongo connection fail in this manner. Wonder if there's a Mongo forum somewhere that could help you? |
I am still experimenting with different setups.
My MongoDB instance is super fast, so I would have no idea where timeouts might come from. However, is there a reason setting them to much shorter values than their defaults? Just removing the two lines will let them default to socketTimeoutMS = 360000 and connectTimeoutMS=10000. One note: One of your changes in https://github.com/nightscout/cgm-remote-monitor/pull/6777/files causes the MONGODB_URI string to be displayed in full in the html error message on the web, including user name and password. |
Right, increasing the timeouts makes sense. Note the connection time can be different from the query performance and if what you're seeing is caused by a connection or socket timing out, that indicates there's something odd either in the networking between the servers or the Mongo server is misbehaving and sleeping, or some other issue that slows down the handshake. |
I was having a very similar issue on my local machine doing development work. The error message said the type was I chatted MongoDB support, and the support rep gave me another connection string to work with instead of the one I was using on my live Nightscout instance on Heroku, which specifically set the name of each shard (rather than referencing the cluster as a whole) and changed a couple options. Original connection string:
New connection string:
Using this new connection string, I have been able to connect to my database on MongoDB Cloud from my local machine. |
I installed linux ubuntu 20.04.2 and nightscout After starting i have logo on black screen "loading the client" .what am i doing wrong? |
On ubuntu, make sure to unset the |
Hello,I ve made 7 attempts to add my Mongo connection string into my Heroku application code (need it for my diabetes application). Keep getting the message: 'Unable to connect to Mongo, MongoDB connection failed! Double check the MONGODB_URI setting in Heroku'. I can think of 2 things going wrong (see attachment)
Thanks for your help! Dear regards Marc |
@marcirene you need to replace password (remove bracket!) with the one you decided in step 3e https://nightscout.github.io/nightscout/new_user/#step-3-create-an-atlas-account Please don't select anything that's not specified in the documentation. If you need to change your Atlas password look at this https://nightscout.github.io/troubleshoot/connection_string/#change-your-atlas-database-password |
Thanks for your help psonnera! Don't get it yet ;) (see attachment 2). My nightscout username is my gmail adres. However Nightscout calls me 'Flieren123' as the username. Do you think this creates the problem? |
...forgot something....do i use the 'big connection string' (see bleu 'check mark') or the small one (whiteout using the check mark?) |
Please follow the documentation. Your Atlas login is different from your database username and password. Make sure to create a database user and a password you write down and use those for the connection string. Flieren123 is your database user. Do not include full code example to obtain the connection string. |
Thank you so much for the simple "remove bracket" instruction! I've been losing my mind for 2 hours trying to figure out what I could possibly be doing wrong! Working now! Thank you SO much!!!!! |
Just had this today on Northflank, with MongoDB as add-on, also in Northflank. The logs weren't very helpful, so what I first did was re-copy MONGO_SRV contents to MONGODB_URI. After the container with the updated config started, NightScout worked again. |
Same occured here 4-6 times during the last 3 weeks. Host: Northflank I had aa4faa6 running without any problems in April-July (maybe August), then something happened, I've started to experience this failure. A newer NS build did not solved it. |
Just had this again some hours ago, running da3b2ee on Northflank. |
Describe the bug
Every day or so my Nightscout crashes with the error message "MongoDB connection failed! Double check the MONGODB_URI setting in Heroku."
The problem appears to be with Nightscout (or AndroidAPS??), I do not need to restart the MongoDB instance and other Nightscout instances continue to work with the same MONGODB_URI without any issues. However I do need to manually restart the Nightscout instance.
Expected behavior
Nightscout should not crash or if it does it should recover automatically.
Screenshots
Your setup information
MongoDB self hosted on a private server, Nightscout Docker (latest dev, but same issue on master) hosted on a different private server. My uploader is AndroidAPS 2.8.1.1
Logs
The text was updated successfully, but these errors were encountered: