nightscout / cgm-remote-monitor

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

Error loading treatments history #8149

Open justmara opened 11 months ago

justmara commented 11 months ago

Describe the bug while rocessing request like this https://****/api/v3/devicestatus/history/1698508526458 I sometimes receive error {"status":500,"message":"Database error"}. NS log only contains this:

MongoError: limit requires an integer
    at Function.create (/opt/app/node_modules/mongodb/lib/core/error.js:59:12)
    at Cursor.limit (/opt/app/node_modules/mongodb/lib/cursor.js:641:24)
    at /opt/app/lib/api3/storage/mongoCollection/find.js:79:8
    at new Promise (<anonymous>)
    at Object.findMany (/opt/app/lib/api3/storage/mongoCollection/find.js:73:10)
    at MongoCollection.self.findMany (/opt/app/lib/api3/storage/mongoCollection/index.js:33:37)
    at MongoCachedCollection.self.findMany (/opt/app/lib/api3/storage/mongoCachedCollection/index.js:24:44)
    at history (/opt/app/lib/api3/generic/history/operation.js:30:38)
    at operation (/opt/app/lib/api3/generic/history/operation.js:139:13) {
  driver: true
}

That happens during AAPS NSClientv3 Full sync, all the requests to devicestatus/history api fails, while treatments/history returns 200ok

image

PS: running 15.0.2 from container: nightscout/cgm-remote-monitor:latest_dev@sha256:719a893007561e163a36a7a00d339088ec6ba3d22ee64f53c394923ac33b86c7

justmara commented 11 months ago

Got it: AAPS does not add limit=X argument to history call. But surely NS must not fail with 500 error without any readable reason returned. This definitely must be 400.

MilosKozak commented 11 months ago

I was not able to replicate this issue on selfhosted and 10be.de instance