Hi there,
I'm trying to migrate my forum to 2.8.2. I have an adapted sso plugin, that adds a GET route to find users by external oauth id.
The plugin works on 1.18 but breaks on 2.8.x already on startup.
The error message is:
2023-01-19T22:37:12.434Z [4567/458] - error: [plugins] Error executing 'static:app.load' in plugin 'nodebb-plugin-sso-oauth-faforever'
Error: Route.get() requires a callback function but got a [object Undefined]
at Route.<computed> [as get] (/usr/src/app/node_modules/express/lib/router/route.js:211:15)
at proto.<computed> [as get] (/usr/src/app/node_modules/express/lib/router/index.js:521:19)
at OAuth.load (/usr/src/app/node_modules/nodebb-plugin-sso-oauth-faforever/library.js:91:10)
The code in question is here:
https://github.com/FAForever/nodebb-plugin-sso-oauth-faforever/blob/ec80064334c0e7a210e9ba5b324bd80d17f5a0c9/library.js#L91
router.get('/api/user/oauth/:externalUserId', middleware.authenticateOrGuest, async function (req, res, next) {
const userId = await db.getObjectField(constants.name + 'Id:uid', req.params.externalUserId);
if (!userId) {
return next();
}
const userData = await userController.getUserDataByUID(req.uid, userId);
I compared to other route.get and also other plugins and even our project express page, but I don't understand where the error could. I tried removing the async but no success. I also googled the error in general, but it doesn't make me much smarter.
Any help is appreciated.