mongodb-memory-server: Can't run mongodb memory server, instance closed with code "127"

Versions

  • NodeJS: v14.17.0
  • mongodb-memory-server-*: 6.9.6
  • mongodb: 3.6.9
  • system: Ubuntu 20.04.2 aarch64

package: mongo-memory-server

What is your question?

when I write this following code

const mongod = await new MongoMemoryServer() ;
console.log(await mongod.getUri());
await mongod.stop() ;

I get the following error

MongoMS:MongoMemoryServer Called MongoMemoryServer.ensureInstance() method +0ms
  MongoMS:MongoMemoryServer  - no running instance, call `start()` command +2ms
  MongoMS:MongoMemoryServer Called MongoMemoryServer.start() method +1ms
  MongoMS:MongoMemoryServer starting with port 36887, since undefined was locked: 36887 +15ms
  MongoMS:MongoMemoryServer Starting MongoDB instance with following options: {"port":36887,"dbName":"b5e2a186-5445-4fd3-b2ad-47f7f5761932","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"/tmp/mongo-mem--6991-2czqRh3CtUpp","tmpDir":{"name":"/tmp/mongo-mem--6991-2czqRh3CtUpp"},"uri":"mongodb://127.0.0.1:36887/b5e2a186-5445-4fd3-b2ad-47f7f5761932?"} +7ms
  MongoMS:MongoBinary MongoBinary options: {
  "downloadDir": "/home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries",
  "platform": "linux",
  "arch": "arm64",
  "version": "4.0.14",
  "checkMD5": false
} +0ms
  MongoMS:MongoBinary MongoBinary: Download lock removed +17ms
  MongoMS:MongoBinary MongoBinary: Mongod binary path: "/home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod" +2ms
  MongoMS:MongoInstance Mongo[36887]: Called MongoInstance._launchKiller(parent: 6991, child: 7002): +0ms
  MongoMS:MongoInstance Mongo[36887]: STDERR: /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory
  MongoMS:MongoInstance  +33ms
  MongoMS:MongoInstance Mongo[36887]: Mongod instance closed with an non-0 code! +6ms
  MongoMS:MongoInstance Mongo[36887]: CLOSE: 127 +1ms
  MongoMS:MongoInstance Mongo[36887]: MongodbInstance: Instance has failed: Mongod instance closed with code "127" +1ms
(node:6991) UnhandledPromiseRejectionWarning: Mongod instance closed with code "127"
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6991) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6991) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  MongoMS:MongoInstance Mongo[36887]: [MongoKiller]: exit - [null,"SIGTERM"] +12ms

then I made symlinks for libssl1.1 as libssl.so.1.0.0 and libcrypto.so.1.1 as libcrypto.so.1.0.0, and I got

MongoMS:MongoMemoryServer Called MongoMemoryServer.ensureInstance() method +0ms
  MongoMS:MongoMemoryServer  - no running instance, call `start()` command +2ms
  MongoMS:MongoMemoryServer Called MongoMemoryServer.start() method +1ms
  MongoMS:MongoMemoryServer starting with port 44329, since undefined was locked: 44329 +15ms
  MongoMS:MongoMemoryServer Starting MongoDB instance with following options: {"port":44329,"dbName":"87b2273b-5395-4ce7-96e9-2e308dda8490","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"/tmp/mongo-mem--6748-z6u2mT0Nh6K5","tmpDir":{"name":"/tmp/mongo-mem--6748-z6u2mT0Nh6K5"},"uri":"mongodb://127.0.0.1:44329/87b2273b-5395-4ce7-96e9-2e308dda8490?"} +6ms
  MongoMS:MongoBinary MongoBinary options: {
  "downloadDir": "/home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries",
  "platform": "linux",
  "arch": "arm64",
  "version": "4.0.14",
  "checkMD5": false
} +0ms
  MongoMS:MongoBinary MongoBinary: Download lock removed +17ms
  MongoMS:MongoBinary MongoBinary: Mongod binary path: "/home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod" +0ms
  MongoMS:MongoInstance Mongo[44329]: Called MongoInstance._launchKiller(parent: 6748, child: 6759): +0ms
  MongoMS:MongoInstance Mongo[44329]: STDERR: /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: /lib/aarch64-linux-gnu/libcrypto.so.1.0.0: version `OPENSSL_1.0.0' not found (required by /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod)
  MongoMS:MongoInstance /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: /lib/aarch64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod)
  MongoMS:MongoInstance /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: /lib/aarch64-linux-gnu/libssl.so.1.0.0: version `OPENSSL_1.0.0' not found (required by /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod)
  MongoMS:MongoInstance /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: /lib/aarch64-linux-gnu/libssl.so.1.0.0: version `OPENSSL_1.0.1' not found (required by /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod)
  MongoMS:MongoInstance  +38ms
  MongoMS:MongoInstance Mongo[44329]: Mongod instance closed with an non-0 code! +6ms
  MongoMS:MongoInstance Mongo[44329]: CLOSE: 1 +1ms
  MongoMS:MongoInstance Mongo[44329]: MongodbInstance: Instance has failed: Mongod instance closed with code "1" +0ms
(node:6748) UnhandledPromiseRejectionWarning: Mongod instance closed with code "1"
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6748) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6748) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  MongoMS:MongoInstance Mongo[44329]: [MongoKiller]: exit - [null,"SIGTERM"] +14ms

how can I overcome these errors ?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 52

Most upvoted comments

this fixed it for me:

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb

this fixed it for me:

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb

Thanks! This solution worked for me!

version 4.2.14 works fine, in the sense a instance starts and I can getUri and instanceInfo, so thanks for the support. I hope pointing this issue helped. Looking forward to contributing more

  • Regards me-nkr

I’m using Ubuntu 22.10 and I’m facing this same issue with mongodb-memory-server when running jest tests.

In order to work around this I needed to install libcrypto.so.1.0.0 from Ubuntu archive since the libcrypto package is not installed by default in Ubuntu 22.04 >=.

You can find how to install it manually from Ubuntu archive repo here: https://stackoverflow.com/a/73251469/9936281

Error: Instance failed to start because a library is missing or cannot be opened: “libcrypto.so.1.1”

https://github.com/nodkz/mongodb-memory-server/issues/732

please search existing issues for those errors first

@andrempeixoto that is the package version, i was meaning the binary version via the config option