• RE: 1.17.0 Breaking Changes

    Authentication middleware is now called on every page and API route. Plugin routes are also affected if they use routeHelpers.setupPageRoute or routeHelpers.setupAPIRoute.

    This fixes an issue we had previously where certain routes were treated by NodeBB as being accessed as guest even though a valid Write API token was passed in. Now, every single page and API route in NodeBB can be authenticated via Write API (or suitable third-party authenticator via response:middleware.authenticate)

    In short, the changes:

    • middleware.authenticate has been deprecated
      • For routes that attach directly to the router (e.g. router.post(...), replace middleware.authenticate with middleware.authenticateRequest and middleware.ensureLoggedIn in order to retain the same behaviour
      • For routes that use setupPageRoute or setupAPIRoute, replace middleware.authenticate with middleware.ensureLoggedIn only.
    • middleware.authenticateOrGuest has been renamed middleware.authenticateRequest
      • Just rename the middleware as necessary

    nodebb/nodebb@7da061f0d7c507146d88ce40a381a2f1d443c5b4

    posted in NodeBB Development
  • RE: Search bar navigation fails if user clicks slowly

    This should be fixed on master and on this forum as well.

    posted in Bug Reports
  • RE: Search bar navigation fails if user clicks slowly

    You are correct, when the input element loses focus it hides the dropdown hence it might miss the click on the result if you click hold a while and release.

    https://github.com/NodeBB/NodeBB/issues/9354

    posted in Bug Reports
  • RE: Forum is not available anymore

    Try to setup some swap if you can, and yes memory can be an issue over time if the database is on the same server as well.

    You said you hit step 3 so that means the build was succesfull with async.waterfall it means it is getting stuck in one of the plugins that is using 'static:app.preload' you can find which plugins use it with the above grep command.

    posted in Technical Support
  • RE: Forum is not available anymore

    Looks like sounds module is just logging the error but not preventing the flow.

    I suggest switching to async.waterfall and checking the plugins using 'static:app.preload' hook and making sure the server has enough memory.

    posted in Technical Support
  • RE: Forum is not available anymore

    Does it work in prod if you disable sounds with this?

    function (next) {
            next();
    	// meta.sounds.init(function (err) {
    	//	console.log('2.sounds');
    	//	next(err);
    	//})
    },
    posted in Technical Support
  • RE: Forum is not available anymore

    If it goes to next step with waterfall, it could be due to the server not having enough ram to run all the build process in parallel.

    Keep it as a waterfall and take a look at your active plugins that are using the hook 'static:app.preload' one of them is not calling the callback properly or has an issue.

    You can run grep -rnw "static:app.preload" node_modules/ to search for that in the node_modules folder.

    posted in Technical Support
  • RE: Forum is not available anymore

    Ok now modify it again to the below to figure out which of those steps is breaking. Like below:

    async.waterfall([
    	async.apply(cacheStaticFiles),
    	async.apply(meta.themes.setupPaths),
    	function(next) {
    		console.log('1');
    		plugins.init(app, middleware, next);
    	},
    	function(next) {
    		console.log('2');
    		async.waterfall([
    			function (next) {
    				meta.templates.compile(function (err) {
    					console.log('2.compile');
    					next(err);
    				});
    			},
    			function (next) {
    				if (!skipJS) {
    					meta.js.minify('nodebb.min.js', function (err) {
    						console.log('2.b.minify');
    						next(err);
    					})
    				} else {
    					meta.js.getFromFile('nodebb.min.js', function (err) {
    						console.log('2.b.getFromFile');
    						next(err);
    					});
    				}
    			},
    			function (next) {
    				if (!skipJS) {
    					meta.js.minify('acp.min.js', function (err) {
    						console.log('2.b.minifyjs');
    						next(err);
    					})
    				} else {
    					meta.js.getFromFile('acp.min.js', function (err) {
    						console.log('2.b.getFromFilejs');
    						next(err);
    					});
    				}
    			},
    			function (next) {
    				if (!skipLess) {
    					meta.css.minify(function (err) {
    						console.log('2.b.minifycss');
    						next(err);
    					})
    				} else {
    					meta.css.getFromFile(function (err) {
    						console.log('2.b.getFromFileCss');
    						next(err);
    					});
    				}
    			},
    			function (next) {
    				meta.sounds.init(function (err) {
    					console.log('2.sounds');
    					next(err);
    				})
    			},
    			function (next) {
    				meta.sounds.init(function (err) {
    					console.log('2.blaclist');
    					next(err);
    				})
    			}
    		], next);
    	},
    	function(results, next) {
    		console.log('3');
    		plugins.fireHook('static:app.preload', {
    			app: app,
    			middleware: middleware
    		}, next);
    	},
    	function(next) {
    		console.log('4');
    		routes(app, middleware);
    		next();
    	}
    ], callback);
    

    Sorry it's a bit long due to all the callbacks and error logging.

    posted in Technical Support
  • RE: Forum is not available anymore

    @nicolas What logs did you get did it not print 3 ?

    posted in Technical Support
  • RE: Forum is not available anymore

    @nicolas Ok if it's not triggering for ./nodebb start you will have to add some more console.logs in here basically add a console.log for each block in that async.waterfall(). My guess is one of the steps before routes(app, middleware); is breaking in production mode, like a build step or a plugin that uses static:app.preload. Change the code to look like this .

    async.waterfall([
    	async.apply(cacheStaticFiles),
    	async.apply(meta.themes.setupPaths),
    	function(next) {
    		console.log('1');
    		plugins.init(app, middleware, next);
    	},
    	function(next) {
    		console.log('2');
    		async.parallel([
    			async.apply(meta.templates.compile),
    			async.apply(!skipJS ? meta.js.minify : meta.js.getFromFile, 'nodebb.min.js'),
    			async.apply(!skipJS ? meta.js.minify : meta.js.getFromFile, 'acp.min.js'),
    			async.apply(!skipLess ? meta.css.minify : meta.css.getFromFile),
    			async.apply(meta.sounds.init),
    			async.apply(meta.blacklist.load)
    		], next);
    	},
    	function(results, next) {
    		console.log('3');
    		plugins.fireHook('static:app.preload', {
    			app: app,
    			middleware: middleware
    		}, next);
    	},
    	function(next) {
    		console.log('4');
    		routes(app, middleware);
    		next();
    	}
    ], callback);
    

    Run it in prod mode and let me know the output.

    posted in Technical Support