TypeError: Cannot read properties of undefined (reading 'length')
-
I successfully installed nodebb a week ago and it has been working well. However, I just found an error while looking at the log file.
This seems to be a database related error. The database I use is mongodb.
The following is the output:2022-02-03T04:23:26.872Z [4567/1383602] - error: GET /topic/53/windows%E4%B8%8B%E5%AE%89%E8%A3%85mysql8
TypeError: Cannot read properties of undefined (reading 'length')
at /home/ubuntu/app/NodeBB/src/database/index.js:17:24
at Array.forEach (<anonymous>)
at Object.primaryDB.parseIntFields (/home/ubuntu/app/NodeBB/src/database/index.js:16:12)
at /home/ubuntu/app/NodeBB/src/user/data.js:184:7
at Array.map (<anonymous>)
at modifyUserData (/home/ubuntu/app/NodeBB/src/user/data.js:179:27)
at User.getUsersFields (/home/ubuntu/app/NodeBB/src/user/data.js:82:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async User.getUsersData (/home/ubuntu/app/NodeBB/src/user/data.js:145:10)
at async User.getUserData (/home/ubuntu/app/NodeBB/src/user/data.js:140:17)
(node:1383602) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)
(Usenode --trace-warnings ...
to show where the warning was created)
2022-02-03T04:23:26.876Z [4567/1383602] - warn: [plugins] filter:user.whitelistFields already resolved in plugin nodebb-plugin-sso-beer-qq
2022-02-03T04:23:26.876Z [4567/1383602] - info: [app] Live analytics saved.
2022-02-03T04:23:26.881Z [4567/1383602] - error: uncaughtException: Cannot read properties of undefined (reading 'length')
TypeError: Cannot read properties of undefined (reading 'length')
at /home/ubuntu/app/NodeBB/src/database/index.js:17:24
at Array.forEach (<anonymous>)
at Object.primaryDB.parseIntFields (/home/ubuntu/app/NodeBB/src/database/index.js:16:12)
at /home/ubuntu/app/NodeBB/src/user/data.js:184:7
at Array.map (<anonymous>)
at modifyUserData (/home/ubuntu/app/NodeBB/src/user/data.js:179:27)
at User.getUsersFields (/home/ubuntu/app/NodeBB/src/user/data.js:82:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async User.getUsersData (/home/ubuntu/app/NodeBB/src/user/data.js:145:10)
at async User.getUserData (/home/ubuntu/app/NodeBB/src/user/data.js:140:17) {"date":"Thu Feb 03 2022 12:23:26 GMT+0800 (China Standard Time)","error":{},"exception":true,"os" -
same error
-
@baris
ubuntu@VM-0-9-ubuntu:~/app/NodeBB$ ./nodebb plugins
2022-02-05T02:09:46.453Z [4567/1782233] - verbose: [minifier] utilizing a maximum of 1 additional threads
Active plugins:
* [email protected] (installed, disabled)
* [email protected] (installed, enabled)
* [email protected] (installed, enabled)
* [email protected] (installed, enabled)
* [email protected] (installed, enabled)
* [email protected] (installed, enabled)
* [email protected] (installed, enabled)
* [email protected] (installed, disabled)
* [email protected] (installed, disabled)
* [email protected] (installed, disabled)
* [email protected] (installed, disabled)
* [email protected] (installed, disabled)
* [email protected] (installed, disabled)
* [email protected] (installed, disabled)
* [email protected] (installed, enabled)
* [email protected] (installed, disabled)
* [email protected] (installed, disabled)
* [email protected] (installed, enabled) -
Try disabling this and see if the issue goes away.
- [email protected] (installed, enabled)
I can't see the source for that plugin. https://github.com/Annihil/nodebb-plugin-email-blacklist
-
@ahoh said in TypeError: Cannot read properties of undefined (reading 'length'):
at Object.primaryDB.parseIntFields (/home/ubuntu/app/NodeBB/src/database/index.js:16:12)
This function is being called with an undefined
requestedFields
property. This shouldn't happen unless a plugin is doing something wrong. Check if any of your plugins are using the hookfilter:user.whitelistFields
you can take a look at/admin/advanced/hooks/
-
@baris said in TypeError: Cannot read properties of undefined (reading 'length'):
Try disabling this and see if the issue goes away.
- [email protected] (installed, enabled)
I can't see the source for that plugin. https://github.com/Annihil/nodebb-plugin-email-blacklist
@baris it is here:
https://github.com/NodeBB-Community/nodebb-plugin-email-blacklist
Actually, previously I wrote it here:
@crazycells said in Registration email domain blacklisting:
hi @julian , will this plugin be updated to work with NodeBB 1.19.0 ?
https://github.com/NodeBB-Community/nodebb-plugin-email-blacklist
currently, it does not prevent registration addresses from the blacklisted domains...
Additionally, the original repository is gone but the broken link is in the package.json, I guess it makes sense to update that too. Thanks in advance.
Maybe @julian can update the link...
I also did not make it work with 1.19.1, it would be great if it can be fixed. It is a very useful plugin.
-
@ahoh said in TypeError: Cannot read properties of undefined (reading 'length'):
plugin nodebb-plugin-sso-beer-qq
remove plugin nodebb-plugin-sso-beer-qq