I'm using express app.param to load objects from db (app.param('userId', users.userById);):
exports.userById = function (req, res, next, id) {
    return user.findOne({
        where: { id: id }
    }).then(function (result) {
        req.user = result;
        next();
    }).catch(function (error) {
        next(error);
    });
};
After that I update the loaded object with the following code.
exports.update = function (req, res) {
    var user = req.user;
    return user.update({
        //update properties
    }).then(function () {
        res.end();
    }).catch(function (error) {
        //error handling
    });
};
For some reason I get the warning that "a promise was created in a handler but was not returned from it".
I can't see why, but that always happen when I use a routing parameter that uses sequelize before making the actual changes to the database.
What is the correct way to do this?
I'm using sequelize v3.23.3 with Postgres.
EDIT
I changed the code to a more simple example that throws the same warning.