mongodb-memory-server: Global install fails on Amazon Linux 2

Versions

  • NodeJS: 14.17.4
  • mongodb-memory-server-*: 7.3.4
  • system: Amazon Linux 2
  • package: mongo-memory-server-global

What is the Problem?

Installation of the mongodb dist fails with

Mongodb-Memory-Server* checking MongoDB binaries
Mongodb-Memory-Server* failed to find an binary:
 Status Code is 403 (MongoDB's 404)
This means that the requested version-platform combination doesn't exist
  Used Url: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel-4.0.25.tgz"

When looking up the URL on https://www.mongodb.org/dl/linux I think it should be linux/mongodb-linux-x86_64-amazon2-4.0.25.tgz. Maybe linux/mongodb-linux-x86_64-rhel70-4.0.25.tgz would also work. Note that rhel seems to no longer exist, but rhel70 does. I guess we could open another issue for that.

I’ve tried setting the download URL via export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon2-v3.6-latest.tgz. This makes the download succeed, but the package is placed with a weird name and subsequent commands fail:

Mongodb-Memory-Server* checking MongoDB binaries
Mongodb-Memory-Server* found binary: "/root/.cache/mongodb-binaries/mongod-x64-amzn"-4.0.25"
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/package.json'

Specifying the download url and version leads to a similar result:

export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon2-v3.6-latest.tgz
export MONGOMS_VERSION=v3.6-latest
Mongodb-Memory-Server* checking MongoDB binaries
Mongodb-Memory-Server* found binary: "/root/.cache/mongodb-binaries/mongod-x64-amzn"-v3.6-latest"
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/package.json'

This is how the ~/.cache/mongodb-binaries/ looks after running the above:

-rwxr-xr-x 1 root root 60297256 Aug  5 20:34 mongod-x64-amzn"-4.0.25
-rwxr-xr-x 1 root root 60297256 Aug  5 20:36 mongod-x64-amzn"-v3.6-latest

I’ve also tried setting MONGOMS_ARCH=linux-x86_64-amazon2. This does not seem to change anything.

Code Example

Start a container with Amazon Linux 2, for example:

docker run -it amazoncorretto:8 /bin/bash

Then from inside the container

yum install -y gcc-c++ make 
curl -sL https://rpm.nodesource.com/setup_14.x | bash - 
yum install -y nodejs
npm install mongodb-memory-server-global@7.3.4

Do you know why it happenes?

no

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17

Commits related to this issue

Most upvoted comments

Download now works, but the extraction somehow fails. Any ideas?

what exactly do you mean? guessing from the log and your ls output, i see nothing wrong (the only problems / error i see in the log is from npm, not related to MMS)

PS: if you mean the size of the binary, no this is not wrong, i downloaded the archive and looked at the file, it is ~61-~63MB (depending on how its shown / counted)

PPS: i would not recommend to have your project in the root of your container (i would recommend to at least put it in a dedicated directory)