Fixing a very common warning of Sequelize.js

February 12, 2019

1 min read


We had this constant error showing up in our development logs :

squelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:236:13

On simple google search, lead me to this huge issue on GitHub https://github.com/sequelize/sequelize/issues/8417.

Conversation over there is huge, there seems to be many potentials solutions, the ones which collaborators most suggested was to disable operator aliasing. So any string based operator will be disabled without any aliases instead symbol based built in operators will be used. This prevents cross site attacks.

const sequelize = new Sequelize(config.databaseUrl, {
  operatorsAliases: false,
})

Follow here for even in detail explanation.