sequelize/sequelize · error · Error

The "logging" option must be set to a function or false, not

Error message

The "logging" option must be set to a function or false, not true. If you want to log all queries, set it to `console.log`.

What it means

The logging option must be either a function (called per query with the SQL string) or false (to silence logging). The boolean true is rejected because it implies logging but provides no sink; use console.log explicitly.

Source

Thrown at packages/core/src/sequelize-typescript.ts:454

Example for Postgres:

new Sequelize({
  dialect: PostgresDialect,
  url: 'postgres://user:pass@localhost/dbname',
});`);
    }

    // @ts-expect-error -- sanity check
    if (options.pool === false) {
      throw new Error(
        'Setting the "pool" option to "false" is not supported since Sequelize 4. To disable the pool, set the "pool"."max" option to 1.',
      );
    }

    // @ts-expect-error -- sanity check
    if (options.logging === true) {
      throw new Error(
        'The "logging" option must be set to a function or false, not true. If you want to log all queries, set it to `console.log`.',
      );
    }

    // @ts-expect-error -- sanity check
    if (options.operatorsAliases) {
      throw new Error(
        'String based operators have been removed. Please use Symbol operators, read more at https://sequelize.org/docs/v7/core-concepts/model-querying-basics/#deprecated-operator-aliases',
      );
    }

    if ('dialectModulePath' in options) {
      throw new Error(
        'The "dialectModulePath" option has been removed, as it is not compatible with bundlers. Please refer to the documentation of your dialect at https://sequelize.org to learn about the alternative.',
      );
    }

    if ('dialectModule' in options) {

View on GitHub (pinned to 7e1deec499)

Solutions

  1. Set logging: console.log to log every query.
  2. Set logging: false to disable logging.
  3. Pass a custom (sql, timing?) => void function.

Example fix

// before
new Sequelize({ dialect, logging: true });

// after
new Sequelize({ dialect, logging: console.log });
Defensive patterns

Strategy: validation

Validate before calling

if (options.logging === true) {
  options.logging = console.log;
}

Prevention

When it happens

Trigger: Passing { logging: true } to the Sequelize constructor or to query options.

Common situations: Developers toggling logging on with a boolean; copied config snippets.

Related errors


AI-assisted analysis of sequelize/sequelize@7e1deec499 (2026-08-03). Data as JSON: /data/errors/01b086e97a97f2ce.json. Report an issue: GitHub.