Found a solution, if anyone ever has a similar problem.. I changed
passport.deserializeUser(function(id, done) {
User.findById(id, function(err, user) {
done(err, user);
});
});
to
passport.deserializeUser(async function(id, done) {
try {
const user = await User.findById(id).exec();
done(null, user);
} catch (err) {
done(err, null);
}
});
And added {} to arrow function before res.render(which wasn't the only problem)