Skip to content

Cannot read property '_promiseOrCallback' of undefined #9597

@kien5436

Description

@kien5436

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
When I call connect from mongoose, it throws an exception

TypeError: Cannot read property '_promiseOrCallback' of undefined
    at Mongoose.connect

If the current behavior is a bug, please provide the steps to reproduce.

Code:

const { connect } = require('mongoose');

async function main() {

  try {
      await connect(env.DB_CONNECTION_STRING, {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        user: env.DB_USER,
        pass: env.DB_PWD,
      });
  }
  catch (err) {
    console.error(err);
  }
}

main();

What is the expected behavior?
Mongoose create connect successfully

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js: v12.18.4
Mongoose: v5.10.15
Mongodb: v4.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugWe've confirmed this is a bug in Mongoose and will fix it.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions