Error when making a new post

General Discussion
  • Hello, now I just updated my forum using git and when I try to make a new post, nodebb crashes, but post is saved to database. Replying works great, happens when making a new topic

    Error
    /home/dovydas/Desktop/~~NodeJS/Forumas/node_modules/mongodb/lib/mongodb/connection/base.js:242
            throw message;      
                  ^
    TypeError: Object 3 has no method 'replace'
        at Object.module.getObjectFields (/home/dovydas/Desktop/~~NodeJS/Forumas/src/database/mongo.js:306:22)
        at Object.module.getObjectField (/home/dovydas/Desktop/~~NodeJS/Forumas/src/database/mongo.js:293:10)
        at /home/dovydas/Desktop/~~NodeJS/Forumas/src/topics.js:156:8
        at /home/dovydas/Desktop/~~NodeJS/Forumas/src/posts.js:81:8
        at Object.<anonymous> (/home/dovydas/Desktop/~~NodeJS/Forumas/src/postTools.js:245:4)
        at /home/dovydas/Desktop/~~NodeJS/Forumas/src/plugins.js:233:16
        at /home/dovydas/Desktop/~~NodeJS/Forumas/node_modules/async/lib/async.js:251:13
        at /home/dovydas/Desktop/~~NodeJS/Forumas/node_modules/async/lib/async.js:139:25
        at /home/dovydas/Desktop/~~NodeJS/Forumas/node_modules/async/lib/async.js:248:17
        at Object.Mentions.addMentions (/home/dovydas/Desktop/~~NodeJS/Forumas/node_modules/nodebb-plugin-mentions/library.js:72:11)
    

    P.S. not sure why code gets strikethrough 😄

  • Hmm... this is odd, it seems to be treating the topic tid as an Object instead of a String. @baris?

  • Can you update to https://github.com/designcreateplay/NodeBB/commit/a974c6fa99c0fc396edc73a190ad716b910b773f and see if it fixes your problem. I guess calling .replace on a number crashes.

  • @baris updated to latest and now server crashes imediately with

    /home/Forumas/node_modules/mongodb/lib/mongodb/connection/base.js:242
            throw message;      
                  ^
    ReferenceError: string is not defined
        at Object.module.getObjectFields (/home/Forumas/src/database/mongo.js:321:28)
        at /home/Forumas/src/webserver.js:211:10
        at /home/Forumas/node_modules/async/lib/async.js:508:21
        at /home/Forumas/node_modules/async/lib/async.js:224:13
        at /home/Forumas/node_modules/async/lib/async.js:108:13
        at Array.forEach (native)
        at _each (/home/Forumas/node_modules/async/lib/async.js:32:24)
        at async.each (/home/Forumas/node_modules/async/lib/async.js:107:9)
        at _asyncMap (/home/Forumas/node_modules/async/lib/async.js:223:9)
        at Object.map (/home/Forumas/node_modules/async/lib/async.js:201:23)
    

    Edit:
    simply there should be string with quotes around like "string" and server starts, but making a new topic results in crash

    /home/Forumas/node_modules/mongodb/lib/mongodb/connection/base.js:242
            throw message;      
                  ^
    TypeError: Object 4 has no method 'replace'
        at Object.module.setObjectField (/home/Forumas/src/database/mongo.js:272:17)
        at /home/Forumas/src/topics.js:162:10
        at /home/Forumas/src/database/mongo.js:313:4
        at /home/Forumas/src/database/mongo.js:346:4
        at /home/Forumas/node_modules/mongodb/lib/mongodb/collection/query.js:147:5
        at /home/Forumas/node_modules/mongodb/lib/mongodb/cursor.js:738:35
        at Cursor.close (/home/Forumas/node_modules/mongodb/lib/mongodb/cursor.js:959:5)
        at Cursor.nextObject (/home/Forumas/node_modules/mongodb/lib/mongodb/cursor.js:738:17)
        at commandHandler (/home/Forumas/node_modules/mongodb/lib/mongodb/cursor.js:713:14)
        at /home/Forumas/node_modules/mongodb/lib/mongodb/db.js:1806:9
    
  • By the way, deleting also crashes

    /home/Forumas/node_modules/mongodb/lib/mongodb/connection/base.js:242
            throw message;      
                  ^
    ReferenceError: uid is not defined
        at Object.ThreadTools.delete (/home/Forumas/src/threadTools.js:103:25)
        at /home/Forumas/src/postTools.js:155:25
        at /home/Forumas/src/threadTools.js:313:6
        at /home/Forumas/node_modules/async/lib/async.js:329:13
        at /home/Forumas/node_modules/async/lib/async.js:139:25
        at /home/Forumas/node_modules/async/lib/async.js:325:21
        at /home/Forumas/src/threadTools.js:306:7
        at /home/Forumas/src/posts.js:289:4
        at /home/Forumas/src/posts.js:278:5
        at Object.Plugins.fireHook (/home/Forumas/src/plugins.js:255:5)
    
  • Hey @dove.

    Please update to https://github.com/designcreateplay/NodeBB/commit/e2fb617cc05cd734a64ec8a68ee9c8b110af3ccd and let me know if your issues are resolved.

  • @baris yes, everything works. Thanks

  • Let us know if you have other problems! The mongodb support isn't 100% tested so I am glad you are using it and reporting bugs 🙂


Suggested Topics


  • Happy New Year 2023

    General Discussion
    6 Votes
    6 Posts
    196 Views

    Happy new year to nodeBB team and all 😉

  • 0 Votes
    5 Posts
    133 Views

    Got it. Updated my last comment for noise. Thank you.

  • 0 Votes
    3 Posts
    1k Views

    I would advise using Nginx infront of it.
    You can google NodeBB Nginx Config and you'll have one you can copy/paste.

    Nginx will then be on port 80 and you can close 4567 on your FW.

  • Strange new users

    General Discussion
    0 Votes
    30 Posts
    10k Views

    @julian said:

    @scottalanmiller Are you utilising spam-be-gone now? (Have you been using it all along?)

    We unofficially take abandoned plugins under the NodeBB umbrella... but don't want to set a precedent... otherwise that org is going to be a dumping ground for half-finished, broken NodeBB plugins 😄

    Not yet, looking to use it soon but don't want to add more plugins while chat and other features are broken.

  • 2 Votes
    11 Posts
    3k Views

    Hmm I don't think we expose isAdmin and isModerator globally to the templates so that you can them everywhere. Maybe we should, everything in the config object is exposed so if you open your console and type config any variable you see under that object you can use in the templates. You can also take a look at the routes by prepending api to the url like https://community.nodebb.org/api/topic/1917/users-shouldn-t-be-able-to-purge-their-posts/10 you can use stuff from there in the template as well.