mongodb-memory-server: Fails to run on Debian Buster (CURL_OPENSSL_3 not found)

Debian Buster, the latest release of Debian GNU/Linux was released on 4th of July 2019.

I upgraded my developer virtual machine to Buster and the mongodb-memory-server hangs.

To test it out I ran this script:

const { MongoMemoryServer } = require('mongodb-memory-server')

async function main () {
  try {
    console.log('Start')
    const mongod = new MongoMemoryServer()
    console.log('Server created...')
    const uri = await mongod.getConnectionString()
    console.log('1')
    const port = await mongod.getPort()
    console.log('2')
    const dbPath = await mongod.getDbPath()
    console.log('3')
    const dbName = await mongod.getDbName()
    console.log('4')

    // some code
    //   ... where you may use `uri` for as a connection string for mongodb or mongoose

    // you may check instance status, after you got `uri` it must be `true`
    console.log('Getting Instance Info...')
    console.dir(mongod.getInstanceInfo())
    mongod.getInstanceInfo() // return Object with instance data

    // you may stop mongod manually
    await mongod.stop()

    // when mongod killed, it's running status should be `false`
    console.dir(mongod.getInstanceInfo())
    console.log('End')
  } catch (err) {
    console.error(err)
  }
}

main()

When running this script the console output displays:

Start
Server created...

After a few seconds the console prompt returns with no error output.

Am I missing something here?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 18 (4 by maintainers)

Commits related to this issue

Most upvoted comments

@grantcarthew I don’t know for you, but for me this is a major problem. Since debian 10 is now officially the ‘stable’ release and not having something like mongodb-memory-server supporting it is a bit of bummer. So, I will pin to version 5.2.7 and just pass in the config:

{
  "binary": {
    "version": "latest"
  }
}

@nodkz this is obviously not a trivial fix. But the ‘4.0.3’ hard-coded version trick might come back biting your hand. It would be preferable to leave my patch in (since Debian 10 is the stable version) and let it fail with a meaningful message such as: default version x.y.z not found. Please specify a version in the config

Life saver! Thanks @msanguineti

I’ve got it working now.

For anyone else looking for a temporary fix, I used my package.json file with the following config:

{
  "config": {
    "mongodbMemoryServer": {
      "version": "latest"
    }
  },
  "devDependencies": {
    "mongodb-memory-server":  "5.2.7"
  }
}