Production NodeBB can not started due to error TypeError: Cannot read properties of null (reading 'uid')
Unsolved
Technical Support
-
My NodeBB forum in production can not started due to this error:
2023-07-28T00:36:19.835Z [4567/2314] - error: TypeError: Cannot read properties of null (reading 'uid')
This error located in:
// src/meta/configs.js:177:39 plugins.hooks.register('core', { hook: 'filter:settings.get', method: async ({ plugin, values }) => { if (plugin === 'core.api' && Array.isArray(values.tokens)) { values.tokens = values.tokens.map((tokenObj) => { tokenObj.uid = parseInt(tokenObj.uid, 10); if (tokenObj.timestamp) { tokenObj.timestampISO = new Date(parseInt(tokenObj.timestamp, 10)).toISOString(); } return tokenObj; }); } return { plugin, values }; }, });
What is the possible cause of this error? I tried to use my dev mongodb and the error gone. I think there is some missing or broken data in my mongodb, but I dont know what it is. Is there anything I need to check?
Thanks in advance.
-
I tried to debug the code and I found this:
2023-07-28T01:25:03.957Z [4567/3584] - verbose: tokenObj null 2023-07-28T01:25:03.957Z [4567/3584] - verbose: tokenObj null 2023-07-28T01:25:03.957Z [4567/3584] - verbose: tokenObj null 2023-07-28T01:25:03.957Z [4567/3584] - verbose: tokenObj null 2023-07-28T01:25:03.957Z [4567/3584] - verbose: tokenObj null 2023-07-28T01:25:03.957Z [4567/3584] - verbose: tokenObj null 2023-07-28T01:25:03.957Z [4567/3584] - verbose: tokenObj null 2023-07-28T01:25:03.957Z [4567/3584] - verbose: tokenObj null
some of the
tokenObj
is null. Why is this happen ? -
@baris it is v3.1.4
I have added this condition:
if(tokenObj) { tokenObj.uid = parseInt(tokenObj.uid, 10); if (tokenObj.timestamp) { tokenObj.timestampISO = new Date(parseInt(tokenObj.timestamp, 10)).toISOString(); } return tokenObj; }
The NodeBB now can running successfully but I still can not access the dashboard
Copyright © 2024 NodeBB | Contributors