Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Connection Timed Out #106

Open
arcenojackson opened this issue Apr 4, 2024 · 0 comments
Open

Error: Connection Timed Out #106

arcenojackson opened this issue Apr 4, 2024 · 0 comments

Comments

@arcenojackson
Copy link

Hi there! We have a problem running the migration commands. With "status" command, we have the response but followed by error. With other commands, we only get the error:

CONNECT ERROR: 
connection timed out
/home/developer/www/dcloud-main/node_modules/mongoose/lib/connection.js:834
  const serverSelectionError = new ServerSelectionError();

The error points to mongoose connection and with some "console.logs" I saw that it is a "connection timed out".
If I comment out the line that return the reject(error), everything works great (Mongoose version: 6.6.3)

client.connect((error) => {
      if (error) {
        console.log('CONNECT ERROR: ');
        console.log(error.message);
        return reject(error);
      }

      _setClient(_this, client, options, dbName);

      for (const db of this.otherDbs) {
        console.log('DB: ');
        console.log(db)
        _setClient(db, client, {}, db.name);
      }

      resolve(_this);
    });

Our mongo-migrate-ts config file (mongo-migrate-ts version: 1.4.0):

mongoMigrateCli({
  uri: '',
  database: '',
  migrationsDir: './migrations',
  migrationsCollection: 'changeCollections',
  useEnv: true,
  environment: {
    uriVar: 'MONGODB_URI',
    databaseVar: '',
  },
  options: {
    serverSelectionTimeoutMS: 45000,
    socketTimeoutMS: 45000,
    keepAlive: true,
    retryReads: true,
    retryWrites: true,
  },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant