function isAuthenticated() {
    return compose()
        .use(function(req, res, next) {
            if (!req.headers.authorization) {
                return res.status(200).send({ status: 'failure', data: [], message: 'Please login to perform this action' });
            }
            try {
                const token = req.headers.authorization;
                const decoded = jwt.verify(token, process.env.SECRET_KEY);
                User.findOne({ where: { id: decoded.id } }).then(userFound => {
                    if (userFound) {
                        req.user = userFound;
                        next();
                    } else {
                        return res.json({ status: 'failure', data: [], message: 'Unauthorised.' });
                    }
                }).catch(e => {
                    return res.json({ status: 'failure', data: [], message: 'Unauthorised' });
                });
            } catch (error) {
                return res.json({ status: 'failure', data: [], message: 'Authentication failed' + error.message });
            }
        });
};
It shows warning like:
(node:9900) Warning: a promise was created in a handler at /home/nodejs/server/auth/auth.service.js:23:25 but was not returned from it, see
How can I handle these warnings, I tried with return statement at different places but it has not resolved.
 
    