[Solved] nodebb crashing after pulling latest



  • I just pulled the latest from github and now my forum is crashing. It appears to be tied to my static-page plugin filter:scripts.get hook. If I remove that hook, it doesn't crash.

    Here's the dump:

    info: [plugins] Hook registered: filter:admin.header.build will call nodebb-plugin-static-leaguezone
    info: [plugins] Hook registered: filter:admin.create_routes will call nodebb-plugin-static-leaguezone
    info: [plugins] Hook registered: filter:header.build will call nodebb-plugin-static-leaguezone
    info: [plugins] Hook registered: filter:server.create_routes will call nodebb-plugin-static-leaguezone
    info: [plugins] Hook registered: filter:scripts.get will call nodebb-plugin-static-leaguezone
    info: [plugins] Hook registered: action:app.load will call nodebb-plugin-static-leaguezone
    info: [plugins] Loaded plugin: nodebb-plugin-static-leaguezone
    info: [plugins] Sorting hooks to fire in priority sequence
    info: [plugins] Plugins OK
    
    path.js:360
            throw new TypeError('Arguments to path.join must be strings');
            ^
    TypeError: Arguments to path.join must be strings
        at path.js:360:15
        at Array.filter (native)
        at Object.exports.join (path.js:358:36)
        at /home/skaught/www/digitalhydros/nodebb/src/meta.js:255:20
        at Array.map (native)
        at Object.<anonymous> (/home/skaught/www/digitalhydros/nodebb/src/meta.js:249:24)
        at /home/skaught/www/digitalhydros/nodebb/src/plugins.js:277:16
        at /home/skaught/www/digitalhydros/nodebb/node_modules/async/lib/async.js:251:13
        at /home/skaught/www/digitalhydros/nodebb/node_modules/async/lib/async.js:139:25
        at /home/skaught/www/digitalhydros/nodebb/node_modules/async/lib/async.js:248:17
    

    Also, here's my hooks from plugin.json

    "hooks": [
    	{ "hook": "filter:admin.header.build", "method": "init.admin.addNavigation", "callbacked": false },
    	{ "hook": "filter:admin.create_routes", "method": "init.admin.addRoute", "callbacked": true },
    	{ "hook": "filter:header.build", "method": "init.global.addNavigation", "callbacked": false },
    	{ "hook": "filter:server.create_routes", "method": "init.global.addRoute", "callbacked": true },
    	{ "hook": "filter:scripts.get", "method": "init.global.addScripts", "callbacked": false },
    	{ "hook": "action:app.load", "method": "init.load", "callbacked": false }
    ]
    

  • GNU/Linux Admin

    @skaughtx0r Can you let me know the array that you are returning to NodeBB in the scripts.get hook?



  • @julian This is what I have in addScripts, but it appears to be crashing before it ever gets called.

    addScripts: function(scripts, callback) {
    	return scripts.concat([
    		"plugins/nodebb-plugin-static-leaguezone/js/transparency.min.js",
    		"plugins/nodebb-plugin-static-leaguezone/js/leagueZone.js",
    		"plugins/nodebb-plugin-static-leaguezone/js/results.js",
    		"plugins/nodebb-plugin-static-leaguezone/js/leagues.js"
    	]);
    }
    

  • Admin

    Can you paste your staticDir(s) from your config please? The recent updates have changed the plugin directories like so:

     "staticDirs": {
            "public": "public"
    },
    

    and in addScripts:

    'plugins/public/lib/designer.js',


  • @psychobunny Oh, maybe I didn't understand the new staticDirs mapping.

    I had it set to:

    "staticDirs": {
        "public":"public"
    }
    

    OK, just did a test and changing "staticDirs" worked. It's not super obvious what the objects meant, since the example I saw just had "public":"public".
    I changed it to be:

    "staticDirs": {
        "pathName": "actualDirectory"
    }
    

    and that worked.

    Here's what my working config looks like:

    "staticDirs": {
        "leaguezone":"public"
    }
    

    and addScripts:

    addScripts: function(scripts, callback) {
        return scripts.concat([
            "plugins/leaguezone/js/transparency.min.js",
            "plugins/leaguezone/js/leagueZone.js",
            "plugins/leaguezone/js/results.js",
            "plugins/leaguezone/js/leagues.js"
        ]);
    }
    

    Thanks!


  • Admin

    Glad you figured it out @skaughtx0r 🙂


Log in to reply
 

Suggested Topics

| |