Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.02k stars 543 forks source link

Server Error - UnhandledPromiseRejhectionWarning #4926

Open blaine07 opened 1 year ago

blaine07 commented 1 year ago

Describe your issue A error in Error log that has never been present previously; see below.

Screenshots If applicable, add screenshots to help explain your problem.

Server Software (please complete the following information):

Today I noticed in logs: -------- 1/18/2023, 8:48:15 PM ---- 1.1.2 --------

(node:158) UnhandledPromiseRejectionWarning: TypeError: Object.fromEntries is not a function at CreateIndexesOperation.indexes.indexes.map.userIndex (/root/node_modules/mongodb/lib/operations/indexes.js:92:46) at Array.map () at new CreateIndexesOperation (/root/node_modules/mongodb/lib/operations/indexes.js:88:32) at new CreateIndexOperation (/root/node_modules/mongodb/lib/operations/indexes.js:128:9) at Collection.createIndex (/root/node_modules/mongodb/lib/collection.js:256:78) at /root/node_modules/meshcentral/db.js:844:34 at promise.then.result (/root/node_modules/mongodb/lib/utils.js:349:28) at process._tickCallback (internal/process/next_tick.js:68:7)

-------- 1/18/2023, 8:48:15 PM ---- 1.1.2 --------

(node:158) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:158) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

-------- 1/18/2023, 8:48:16 PM ---- 1.1.2 --------

(node:158) UnhandledPromiseRejectionWarning: TypeError: Object.fromEntries is not a function at CreateIndexesOperation.indexes.indexes.map.userIndex (/root/node_modules/mongodb/lib/operations/indexes.js:92:46) at Array.map () at new CreateIndexesOperation (/root/node_modules/mongodb/lib/operations/indexes.js:88:32) at new CreateIndexOperation (/root/node_modules/mongodb/lib/operations/indexes.js:128:9) at Collection.createIndex (/root/node_modules/mongodb/lib/collection.js:256:78) at /root/node_modules/meshcentral/db.js:969:45 at promise.then.result (/root/node_modules/mongodb/lib/utils.js:349:28) at process._tickCallback (internal/process/next_tick.js:68:7)

-------- 1/18/2023, 8:48:16 PM ---- 1.1.2 --------

(node:158) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

-------- 1/18/2023, 8:48:16 PM ---- 1.1.2 --------

(node:158) UnhandledPromiseRejectionWarning: TypeError: Object.fromEntries is not a function at CreateIndexesOperation.indexes.indexes.map.userIndex (/root/node_modules/mongodb/lib/operations/indexes.js:92:46) at Array.map () at new CreateIndexesOperation (/root/node_modules/mongodb/lib/operations/indexes.js:88:32) at new CreateIndexOperation (/root/node_modules/mongodb/lib/operations/indexes.js:128:9) at Collection.createIndex (/root/node_modules/mongodb/lib/collection.js:256:78) at /root/node_modules/meshcentral/db.js:942:39 at promise.then.result (/root/node_modules/mongodb/lib/utils.js:349:28) at process._tickCallback (internal/process/next_tick.js:68:7) (node:158) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

-------- 1/18/2023, 8:48:16 PM ---- 1.1.2 --------

(node:158) UnhandledPromiseRejectionWarning: TypeError: Object.fromEntries is not a function at CreateIndexesOperation.indexes.indexes.map.userIndex (/root/node_modules/mongodb/lib/operations/indexes.js:92:46) at Array.map () at new CreateIndexesOperation (/root/node_modules/mongodb/lib/operations/indexes.js:88:32) at new CreateIndexOperation (/root/node_modules/mongodb/lib/operations/indexes.js:128:9) at Collection.createIndex (/root/node_modules/mongodb/lib/collection.js:256:78) at /root/node_modules/meshcentral/db.js:917:40 at promise.then.result (/root/node_modules/mongodb/lib/utils.js:349:28) at process._tickCallback (internal/process/next_tick.js:68:7)

-------- 1/18/2023, 8:48:16 PM ---- 1.1.2 --------

(node:158) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)

I am unsure if it's something I need to be concerned about or if just a "warning"? I have never noticed in logs before. Is it something to worry about? Can/does it need to be fixed and how?

OutbackMatt commented 1 year ago

They were all at the same time Do these errors continue?

If not, I'd say that this is fine and that there was something else happening on your server at the time that caused this.

blaine07 commented 1 year ago

They were all at the same time Do these errors continue?

If not, I'd say that this is fine and that there was something else happening on your server at the time that caused this.

Yes, error stuff, above, happens every time I reboot server.

blaine07 commented 1 year ago

servererrors.txt

Still not sure what to do here/if i shold or shouldn't be worried.

blaine07 commented 1 year ago

Tonight went through all the trouble to spin up a entirely new MeshCentral Instance on my XCP-ng server and getting exactly the same 'errors' in the log:

blaine07@mc:~$ node ./node_modules/meshcentral Resetting events indexes... Resetting power events indexes... Resetting server stats indexes... ERR: (node:31794) UnhandledPromiseRejectionWarning: TypeError: Object.fromEntries is not a function at CreateIndexesOperation.indexes.indexes.map.userIndex (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:92:46) at Array.map () at new CreateIndexesOperation (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:88:32) at new CreateIndexOperation (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:128:9) at Collection.createIndex (/home/blaine07/node_modules/mongodb/lib/collection.js:256:78) at /home/blaine07/node_modules/meshcentral/db.js:917:40 at promise.then.result (/home/blaine07/node_modules/mongodb/lib/utils.js:349:28) at process._tickCallback (internal/process/next_tick.js:68:7) ERR: (node:31794) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:31794) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. ERR: (node:31794) UnhandledPromiseRejectionWarning: TypeError: Object.fromEntries is not a function at CreateIndexesOperation.indexes.indexes.map.userIndex (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:92:46) at Array.map () at new CreateIndexesOperation (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:88:32) at new CreateIndexOperation (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:128:9) at Collection.createIndex (/home/blaine07/node_modules/mongodb/lib/collection.js:256:78) at /home/blaine07/node_modules/meshcentral/db.js:969:45 at promise.then.error (/home/blaine07/node_modules/mongodb/lib/utils.js:349:66) at process._tickCallback (internal/process/next_tick.js:68:7) ERR: (node:31794) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3) Resetting main indexes... MeshCentral HTTP redirection server running on port 80. MeshCentral v1.1.2, Hybrid (LAN + WAN) mode. ERR: (node:31794) UnhandledPromiseRejectionWarning: TypeError: Object.fromEntries is not a function at CreateIndexesOperation.indexes.indexes.map.userIndex (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:92:46) at Array.map () at new CreateIndexesOperation (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:88:32) at new CreateIndexOperation (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:128:9) at Collection.createIndex (/home/blaine07/node_modules/mongodb/lib/collection.js:256:78) at /home/blaine07/node_modules/meshcentral/db.js:942:39 at promise.then.result (/home/blaine07/node_modules/mongodb/lib/utils.js:349:28) at process._tickCallback (internal/process/next_tick.js:68:7) ERR: (node:31794) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4) ERR: (node:31794) UnhandledPromiseRejectionWarning: TypeError: Object.fromEntries is not a function at CreateIndexesOperation.indexes.indexes.map.userIndex (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:92:46) at Array.map () at new CreateIndexesOperation (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:88:32) at new CreateIndexOperation (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:128:9) at Collection.createIndex (/home/blaine07/node_modules/mongodb/lib/collection.js:256:78) at /home/blaine07/node_modules/meshcentral/db.js:844:34 at promise.then.result (/home/blaine07/node_modules/mongodb/lib/utils.js:349:28) at process._tickCallback (internal/process/next_tick.js:68:7) ERR: (node:31794) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5) MeshCentral Intel(R) AMT server running on xx.xxxx.net:4433.

si458 commented 1 year ago

The error is actually happening after the first line (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:92:46)

So the error is actually nothing to do with meshcentral but the mongodb module!

What is your config.json?

Edit: can u do a npm list and check what version of mongodb is installed

blaine07 commented 1 year ago

The error is actually happening after the first line (/home/blaine07/node_modules/mongodb/lib/operations/indexes.js:92:46)

So the error is actually nothing to do with meshcentral but the mongodb module!

What is your config.json?

Edit: can u do a npm list and check what version of mongodb is installed

Struggling to get this to work behind cloudflare too; but I think that’s a separate issue.

I think I sanitized:

"$schema": "https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json", "comment1": "This is a simple configuration file, all values and sections that start with underscore () are ignored. Edit a section and remove the in front of the name. Refer to the user's guide for details.", "comment2": "See node_modules/meshcentral/sample-config-advanced.json for a more advanced example.", "settings": { "MongoDb": "mongodb://127.0.0.1:27017/meshcentral", "cert": "xxx.xxx.net", "_WANonly": true, "_LANonly": true, "_sessionKey": "Waffles2022&", "port": 443, "_aliasPort": 443, "redirPort": 80, "_redirAliasPort": 80, "AgentPong": 300, "TLSOffload": false, "SelfUpdate": false, "AllowFraming": "false", "WebRTC": "true" }, "domains": { "": { "Title": "B Supported", "_title": "MyServer", "_title2": "Servername", "_minify": true, "newAccounts": false, "_userNameIsEmail": true, "certUrl": "https://xxx.xxx.net:443" } }, "_letsencrypt": { "comment": "Requires NodeJS 8.x or better, Go to https://letsdebug.net/ first before trying Let's Encrypt.", "email": "myemail@mydomain.com", "names": "myserver.mydomain.com", "production": false } }

blaine07 commented 1 year ago

F94044DF-A38E-48CD-8EF3-5E7C1B94241C

I installed MongoDB on both servers like this; didn’t use NPM?

si458 commented 1 year ago

That's a third party website, so I cannot confirm if docs are correct

This is official docs from @Ylianst and the community

https://ylianst.github.io/MeshCentral/install/install2/#configuring-for-mongodb

I'll have a play later and see if I can find what's wrong

aymenBox commented 1 year ago

Hi, did you find any solution for this ?