Sequelize logging questions marks instead of values after migrating to V5

Tags: , , ,



After migrating to v5 from v4, Sequelize logs question marks on the console instead of the values of the SQL queries.

For instance, this is what is shown on the console:

INSERT INTO `Product` (`uid`,`title`,`price`,`isPerishable`,`categoryId`) VALUES (?,?,?,?,?);

This is my Sequelize instance:

db = new Sequelize({
      dialect: 'mysql',
      database: process.env.DB_NAME,
      username: process.env.DB_USER,
      password: process.env.DB_PASS,
      host: process.env.DB_HOST,
      operatorsAliases: operatorsAliases,
      logging: console.log,
    });

Whether before, on version 4, the values were being displayed correctly.

What I am expecting to be logged is somethings like:

INSERT INTO `Product` (`uid`,`title`,`price`,`isPerishable`,`categoryId`) VALUES (DEFAULT,'iPhone X',999.99,false,'1');

Answer

You will still have the question marks, but you will see the input right next to the query.

Just add this to the Sequalize config

logQueryParameters: true



Source: stackoverflow