Error updating sequelize 4.40 in my project

0

I am developing a platform in which I updated sequelize to version 4.40 and it tells me the following error.

  

error: TypeError: Can not read property 'name' of undefined       at Function._validateIncludedElement (C: \ Users \ Zrismart23 \ Documents \ GitHub \ new-management \ sip \ node_modules \ sequelize \ lib \ model.js: 535: 42)       at options.include.options.include.map.include (C: \ Users \ Zrismart23 \ Documents \ GitHub \ new-management \ sip \ node_modules \ sequelize \ lib \ model.js: 395: 37)       at Array.map ()       at Function._validateIncludedElements (C: \ Users \ Zrismart23 \ Documents \ GitHub \ new-management \ sip \ node_modules \ sequelize \ lib \ model.js: 390: 39)       at Promise.try.then.then (C: \ Users \ Zrismart23 \ Documents \ GitHub \ new-management \ sip \ node_modules \ sequelize \ lib \ model.js: 1570: 14)   From previous event:       at Function.findAll (C: \ Users \ Zrismart23 \ Documents \ GitHub \ new-management \ sip \ node_modules \ sequelize \ lib \ model.js: 1566: 8)       at Function.findOne (C: \ Users \ Zrismart23 \ Documents \ GitHub \ new-management \ sip \ node_modules \ sequelize \ lib \ model.js: 1752: 17)       at C: \ Users \ Zrismart23 \ Documents \ GitHub \ management-new \ sip \ routes \ sistema.js: 43: 50   From previous event:       at req.session.save (C: \ Users \ Zrismart23 \ Documents \ GitHub \ management-new \ sip \ routes \ system.js: 41: 28)       at runCallback (timers.js: 810: 20)       at tryOnImmediate (timers.js: 768: 5)       at processImmediate [as _immediateCallback] (timers.js: 745: 5)

The code of the route is as follows:

menu.builUserdMenu(req, function (err, data) {
            if (data) {
                req.session.save(() => {
                    req.session.passport.sidebar = data
                    models.pagina.belongsTo(models.sistema, {
                        foreignKey: 'idsistema'
                    });
                    models.pagina.belongsTo(models.contenido, {
                        foreignKey: 'idcontenido'
                    });

                    return models.sistema.findOne({
                        where: {
                            id: idsistema
                        }
                    }).then(function (home) {

                        return models.pagina.findOne({
                            where: {
                                nombre: home.pagina
                            },
                            include: [{
                                    model: models.sistema
                                },
                                {
                                    model: models.contenido
                                }
                            ]
                        }).then(function (pagina) {
                            var tmpl = pug.renderFile(pagina.contenido.plantilla, {
                                title: pagina.title
                            });
                            var script = ""
                            if (pagina.script)
                                script = pug.render(pagina.script);

                            return res.render(home.pagina, {
                                user: req.user,
                                data: data,
                                page: home.pagina,
                                title: pagina.title,
                                type: pagina.contenido.nombre,
                                idtype: pagina.contenido.id,
                                html: tmpl,
                                script: script
                            });
                        }).catch(function (err) {
                            logger.error(err);
                        });

                    }).catch(function (err) {
                        logger.error(err);
                    });
                })
            } else {
                res.render('index', {
                    message: err
                });
            }
        });

I would be grateful if you could help me, since I have been a full week trying to solve my problem.

    
asked by Nelson Alegría Bello 29.10.2018 в 18:34
source

0 answers