How to fix TypeError: Cannot set property 'uid' of undefined?



  • Here is my log and after a mongo error I restarted the server and everything is working fine except one error keeps on repeating when I try to add user from registration queue.

    5/11 17:00:00 [22751] - info: [user/jobs] Did not send digests (day) because subscription system is disabled.
    5/11 17:00:00 [22751] - info: [user/jobs] Did not send digests (week) because subscription system is disabled.
    5/11 17:02:00 [22751] - error: MongoError: WiredTigerIndex::insert: key too large to index, failing 1311 { : "errors:404", : "/topic/11/need-to-add-auto-fetchdata:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADXklEQVQ4T2VUXUgjZxS9X8YYRxNjxmJsZBwUWpUFNVQ7igtB..." }
    at Function.MongoError.create (/home/kgec-ubuntu-14/nodebb/node_modules/mongodb-core/lib/error.js:31:11)
    at /home/kgec-ubuntu-14/nodebb/node_modules/mongodb-core/lib/connection/pool.js:497:72
    at authenticateStragglers (/home/kgec-ubuntu-14/nodebb/node_modules/mongodb-core/lib/connection/pool.js:443:16)
    at Connection.messageHandler (/home/kgec-ubuntu-14/nodebb/node_modules/mongodb-core/lib/connection/pool.js:477:5)
    at Socket.<anonymous> (/home/kgec-ubuntu-14/nodebb/node_modules/mongodb-core/lib/connection/connection.js:331:22)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:547:20)
    [cluster] Restarting...
    Clustering enabled: Spinning up 1 process(es).

    5/11 18:15:36 [22751] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    5/11 18:15:36 [22751] - info: [app] Database connection closed.
    5/11 18:15:36 [22751] - info: [app] Web server closed to connections.
    5/11 18:15:36 [22751] - info: [app] Shutdown complete.
    [cluster] Child Process (22751) has exited (code: 0, signal: null)
    5/11 18:15:38 [22886] - info: Initializing NodeBB v1.6.1 http://forum.kgec.edu.in
    5/11 18:15:40 [22886] - info: [socket.io] Restricting access to origin: http://forum.kgec.edu.in😘
    5/11 18:15:41 [22886] - warn: [plugins/nodebb-plugin-spam-be-gone] Hook action:flag.create is deprecated, please use action:flags.create instead.
    5/11 18:15:41 [22886] - info: Default list of Banned Words is enabled. Please go to administration panel to change the list.
    5/11 18:15:41 [22886] - info: [plugins/spam-be-gone] Settings loaded
    5/11 18:15:41 [22886] - info: Routes added
    5/11 18:15:41 [22886] - info: NodeBB Ready
    5/11 18:15:41 [22886] - info: Enabling 'trust proxy'
    5/11 18:15:41 [22886] - info: NodeBB is now listening on: 0.0.0.0:4567
    User Data: [object Object]
    5/11 18:52:01 [22886] - error: TypeError: Cannot set property 'uid' of undefined
    at /home/kgec-ubuntu-14/nodebb/src/user/create.js:65:18
    at nextTask (/home/kgec-ubuntu-14/nodebb/node_modules/async/dist/async.js:5297:14)
    at next (/home/kgec-ubuntu-14/nodebb/node_modules/async/dist/async.js:5304:9)
    at /home/kgec-ubuntu-14/nodebb/node_modules/async/dist/async.js:906:16
    at /home/kgec-ubuntu-14/nodebb/src/database/mongo/hash.js:247:4
    at handleCallback (/home/kgec-ubuntu-14/nodebb/node_modules/mongodb/lib/utils.js:120:56)
    at /home/kgec-ubuntu-14/nodebb/node_modules/mongodb/lib/collection.js:2494:14
    at handleCallback (/home/kgec-ubuntu-14/nodebb/node_modules/mongodb/lib/utils.js:120:56)
    at /home/kgec-ubuntu-14/nodebb/node_modules/mongodb/lib/db.js:315:5
    at /home/kgec-ubuntu-14/nodebb/node_modules/mongodb-core/lib/connection/pool.js:469:18
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    5/11 18:52:01 [22886] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    5/11 18:52:01 [22886] - info: [app] Database connection closed.
    5/11 18:52:01 [22886] - info: [app] Web server closed to connections.
    5/11 18:52:01 [22886] - info: [app] Shutdown complete.
    [cluster] Child Process (22886) has exited (code: 1, signal: null)
    [cluster] Spinning up another process...
    5/11 18:52:03 [22976] - info: Initializing NodeBB v1.6.1 http://forum.kgec.edu.in
    5/11 18:52:05 [22976] - info: [socket.io] Restricting access to origin: http://forum.kgec.edu.in😘
    5/11 18:52:06 [22976] - warn: [plugins/nodebb-plugin-spam-be-gone] Hook action:flag.create is deprecated, please use action:flags.create instead.
    5/11 18:52:06 [22976] - info: [plugins/spam-be-gone] Settings loaded
    5/11 18:52:06 [22976] - info: Default list of Banned Words is enabled. Please go to administration panel to change the list.
    5/11 18:52:06 [22976] - info: Routes added
    5/11 18:52:06 [22976] - info: NodeBB Ready
    5/11 18:52:06 [22976] - info: Enabling 'trust proxy'
    5/11 18:52:06 [22976] - info: NodeBB is now listening on: 0.0.0.0:4567
    User Data: [object Object]
    5/11 18:53:44 [22976] - error: TypeError: Cannot set property 'uid' of undefined
    at /home/kgec-ubuntu-14/nodebb/src/user/create.js:65:18
    at nextTask (/home/kgec-ubuntu-14/nodebb/node_modules/async/dist/async.js:5297:14)
    at next (/home/kgec-ubuntu-14/nodebb/node_modules/async/dist/async.js:5304:9)
    at /home/kgec-ubuntu-14/nodebb/node_modules/async/dist/async.js:906:16
    at /home/kgec-ubuntu-14/nodebb/src/database/mongo/hash.js:247:4
    at handleCallback (/home/kgec-ubuntu-14/nodebb/node_modules/mongodb/lib/utils.js:120:56)
    at /home/kgec-ubuntu-14/nodebb/node_modules/mongodb/lib/collection.js:2494:14
    at handleCallback (/home/kgec-ubuntu-14/nodebb/node_modules/mongodb/lib/utils.js:120:56)
    at /home/kgec-ubuntu-14/nodebb/node_modules/mongodb/lib/db.js:315:5
    at /home/kgec-ubuntu-14/nodebb/node_modules/mongodb-core/lib/connection/pool.js:469:18
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    5/11 18:53:44 [22976] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    5/11 18:53:44 [22976] - info: [app] Database connection closed.
    5/11 18:53:44 [22976] - info: [app] Web server closed to connections.
    5/11 18:53:44 [22976] - info: [app] Shutdown complete.
    [cluster] Child Process (22976) has exited (code: 1, signal: null)
    [cluster] Spinning up another process...
    5/11 18:53:45 [23004] - info: Initializing NodeBB v1.6.1 http://forum.kgec.edu.in
    5/11 18:53:47 [23004] - info: [socket.io] Restricting access to origin: http://forum.kgec.edu.in😘
    5/11 18:53:47 [23004] - warn: [plugins/nodebb-plugin-spam-be-gone] Hook action:flag.create is deprecated, please use action:flags.create instead.
    5/11 18:53:48 [23004] - info: Default list of Banned Words is enabled. Please go to administration panel to change the list.
    5/11 18:53:48 [23004] - info: [plugins/spam-be-gone] Settings loaded
    5/11 18:53:48 [23004] - info: Routes added
    5/11 18:53:48 [23004] - info: NodeBB Ready
    5/11 18:53:48 [23004] - info: Enabling 'trust proxy'
    5/11 18:53:48 [23004] - info: NodeBB is now listening on: 0.0.0.0:4567


  • Admin

    @sumit-roy said in How to fix TypeError: Cannot set property 'uid' of undefined?:

    5/11 18:53:44 [22976] - error: TypeError: Cannot set property 'uid' of undefined
    at /home/kgec-ubuntu-14/nodebb/src/user/create.js:65:18

    What plugins do you have active? The only way userdata could be undefined there is if some plugin is altering it filter:user.create



  • Solved. add-registration-field plugin was the culprit. An undefined field was added in the registration page causing the error in adding a user in the database.
    alt text


 

| |