Skip to content

Error message when closing a connection too soon #149

@kernfeld-cockroach

Description

@kernfeld-cockroach

This example code outputs an error:

const { Sequelize } = require("sequelize-cockroachdb");

const sequelize = new Sequelize(process.env.DATABASE_URL);

(async () => {
  try {
    const [results, metadata] = await sequelize.query("SELECT NOW()");
    console.log(results);
  } catch (err) {
    console.error("error executing query:", err);
  } finally {
    await sequelize.close();
  }
})();

The error is as follows:

Executing (default): SELECT version() AS version
Executing (default): SELECT NOW()
Executing (default): SELECT crdb_internal.increment_feature_counter(concat('Sequelize ', '6.19'))
[ { now: 2022-05-23T20:29:50.787Z } ]
Could not record telemetry.
Error: ConnectionManager.getConnection was called after the connection manager was closed!

We suspect that this problem was because the connection was closed quickly. However, the user didn't really do anything wrong in this case, nor do they likely care whether the telemetry was recorded successfully. Suggested solution: don't output a user-facing error when we fail to record telemetry.

CC @rafiss @RichardJCai

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions