Unsolved URI api/v3/users/136 gives Error 404 - user not existent

  • Hi all,

    System info:

    * Ubuntu     18.04.6 LTS
    * node       14.15.3
    * nodebb     1.19.0
    * npm        8.3.0

    I have a weird phenomenon.

    When I log in to the "Admin panel -> Manage -> Users" I see a certain user.
    Lets call him John Doe.
    When I mark this "User" and go to "Actions -> Delete User" I get an 404 Error for my URI.
    The same for

    Statuscode from "api/v3/users/136" is:

        status: {
            code: "not-found",
            message: "User does not exist"
        response: { }

    And by the way, the user has not been deleted.

    So what can i do, to prevent this error?
    And how can I delete this user?

    "Settings -> API Access":
    A Master Token is present and httpS is off.


  • NodeBB Admin

    Is there an entry for that uid in the database? Check the key user:136 and check users:joindate for the value 136. On mongodb :

    db.objects.findOne({_key: "user:136"});
    db.objects.findOne({_key: "users:joindate", value: "136"});

  • Hey @baris

    thanks for the advice.

    Result is:

    > db.objects.findOne({_key: "user:136"});
            "_id" : ObjectId("5af82062ad5173788d7841d8"),
            "_key" : "user:136",
            "username" : "**********",
            "userslug" : "**********",
            "email" : "**********",
            "joindate" : 1526210658941,
            "lastonline" : 1607610706017,
            "picture" : "",
            "fullname" : "**********",
            "location" : "",
            "birthday" : "**********",
            "uploadedpicture" : "",
            "profileviews" : 32,
            "postcount" : 1,
            "lastposttime" : 1526487797565,
            "status" : "online",
            "gdpr_consent" : 0,
            "acceptTos" : 0,
            "uid" : "136",
            "passwordExpiry" : 1621247179428,
            "password" : "**********",
            "groupTitle" : "[]",
            "aboutme" : "",
            "email:confirmed" : 1,
            "rss_token" : "e2325fb3-7142-4525-8ad8-0f2f731c7a9d",
            "banned:expire" : 0,
            "website" : "",
            "signature" : ""
    > db.objects.findOne({_key: "users:joindate", value: "136"});

    If you see the start "**********" there is real data behind, I just masked it, because of the EU GDPR.

    So the problem may be the "null" joindate?

  • NodeBB Admin

    Yeah it could be try adding uid 136 to users:joindate and try deleting it again.

    db.objects.insert({_key: "users:joindate", valua: "136", score: 1526210658941 });

  • Hi @baris

    I followed your advice. But still no success.
    I opened the Developer Tools in my browser before I deleted the user 136 in the forums backend
    and it still gives an error:
    /api/v3/users/136/account 404

    Message sais "User does not exists" or similar ... I am in a german backend here 😉

    Seems to be a problem in or with jquery, in jquery.js. At least this is what the dev ools are telling ...

    I even tried this from a directly connected line to the internet, no firewalls, no WAFs, no piHoles etc.
    to be sure that the traffice has not been altered in a certain way.
    Still the same behaviour as mentioned above.

    Unfortunately, I am not that kind of a "dev genius",
    so I am not able to investigate this specific error further.

    Anyone any ideas, advices, suggestions ... ? 🤔

  • NodeBB Admin

    @baris said in URI api/v3/users/136 gives Error 404 - user not existent:

    db.objects.insert({_key: "users:joindate", valua: "136", score: 1526210658941 });

    There is a typo in my previous message should be

    db.objects.insert({_key: "users:joindate", value: "136", score: 1526210658941 });

  • @baris
    I executed yor command with the following result:

    WriteResult({ "nInserted" : 1 })

    The user could be deleted successfully! Thanks! 👍
    So, it seems that an emtpy joindate for a user is definetly a problem.

    How would be the command to make all "joindates" which are empty, to be set to " 01-01-1970"?

    Could you advise?

    So in the future, I would not have the same problem again 😉

  • NodeBB Admin

    I think the real issue is to figure out why they were empty in the first place. When a user is created user:136 object and the entry in users:joindate should be both created.

    In this case you will have to run a custom script to add the missing entries. Place the following code in a javascript file name custom_scripts.js in your nodebb folder and run it with node custom_script.js

    /* globals require, console, process */
    'use strict';
    const nconf = require('nconf');
    	file: 'config.json',
    	base_dir: __dirname,
    	views_dir: './build/public/templates',
    	upload_path: 'public/uploads',
    const db = require('./src/database');
    db.init(async (err) => {
    	if (err) {
    		console.log(`NodeBB could not connect to your database. Error: ${err.message}`);
    	await addMissingJoinDates();
    async function addMissingJoinDates() {
    	const batch = require('./src/batch');
    	const user = require('./src/user');
    	const total = await db.sortedSetCard('users:joindate');
    	let counter = 0;
    	await batch.processSortedSet('users:joindate', async (uids) => {
    		const userData = await user.getUsersFields(uids, ['uid', 'joindate']);
    		counter += uids.length;
    		await db.sortedSetAddBulk(
    			userData.map(data => ['users:joindate', data.joindate, userData.uid])
    		console.log(`${counter} / ${total}`);
    	}, {
    		batch: 500,

Suggested Topics

| | |

© 2014 – 2022 NodeBB, Inc. — Made in Canada.