nightscout / cgm-remote-monitor

nightscout web monitor
GNU Affero General Public License v3.0
2.36k stars 71.43k forks source link

new TypeError messages in 15.0.0 log file #8146

Closed jonwilts closed 9 months ago

jonwilts commented 9 months ago

Describe the bug

Updated to 15.0.0 earlier this week. Running locally on Ubuntu 22.04.3, using node.js 18.18.2.

Everything seems to be working fine. However, in the log file I'm repeatedly getting the following message:

Oct 27 09:37:16 server nightscout[1574758]: got data-received event, requesting reload
Oct 27 09:37:16 server nightscout[1574758]: data loaded: reloading sandbox data and updating plugins
Oct 27 09:37:21 server nightscout[1574758]: TypeError: api(...).insert is not a function
Oct 27 09:37:21 server nightscout[1574758]:     at Function.create (/home/ns/.bin/nightscout/cgm-remote-monitor.10-25-23/lib/server/profile.js:11:11)
Oct 27 09:37:21 server nightscout[1574758]:     at /home/ns/.bin/nightscout/cgm-remote-monitor.10-25-23/lib/api/profile/index.js:66:25
Oct 27 09:37:21 server nightscout[1574758]:     at Layer.handle [as handle_request] (/home/ns/.bin/nightscout/cgm-remote-monitor.10-25-23/node_modules/express/lib/router/layer.js:95:5)
Oct 27 09:37:21 server nightscout[1574758]:     at next (/home/ns/.bin/nightscout/cgm-remote-monitor.10-25-23/node_modules/express/lib/router/route.js:137:13)
Oct 27 09:37:21 server nightscout[1574758]:     at check (/home/ns/.bin/nightscout/cgm-remote-monitor.10-25-23/lib/authorization/index.js:268:9)
Oct 27 09:37:21 server nightscout[1574758]:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

To Reproduce

Hard to say. Install Nightscout 15.0.0 and run using node.js 18.18.2.

Expected behavior

Everything seems to be working ok - we appear to have normal nightscout functionality, but I'm assuming this log message means something isn't working as expected.

These messages did not appear previously (using 14.2.6).

Screenshots See log file snipped above.

Your setup information

Additional context

jonwilts commented 9 months ago

Downgraded node.js to 16.20.2 and still getting the issue. Log file attached. First instance of the error occurs at 14:58 - more than 50 minute after restarting Nightscout - but then seems to occur regularly. nightscout.log

jonwilts commented 9 months ago

Ok - further investigation shows that this was caused by the update to mongodb-js and so is a duplicate of (or at least related to) 8111.

Updating to 15.0.2 appears to have solved the problem.

I am still seeing:

Oct 31 12:02:21 server nightscout[2369822]: (node:2369822) DeprecationWarning: collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead
Oct 31 12:02:21 server nightscout[2369822]: (Use node --trace-deprecation ... to show where the warning was created)

but nothing is broken.