typegoose / mongodb-memory-server

Manage & spin up mongodb server binaries with zero(or slight) configuration for tests.
https://typegoose.github.io/mongodb-memory-server/
MIT License
2.56k stars 185 forks source link

Amazon EC2 instance download failed, combination does not exist (403) #825

Closed phaseharry closed 10 months ago

phaseharry commented 10 months ago

Versions

package: mongo-memory-server

What is your question?

Using mongo-memory-server to write unit tests and it works locally on my machine. The above versions are those of the ec2 instance. When sent to an ec2 container to build and run unit tests, for some reason it doesn't seem like it can fetch for the mongo binaries. I get the following error message:

Starting the MongoMemoryServer Instance failed, enable debug log for more information. Error:
DownloadError: Download failed for url "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-7.0.0.tgz", Details: Status Code is 403 (MongoDB's 404). This means that the requested version-platform combination doesn't exist
Try to use different version 'new MongoMemoryServer({ binary: { version: 'X.Y.Z' } })'
List of available versions can be found here: https://www.mongodb.com/download-center/community/releases/archive

current config within my package.json:

 "config": {
    "mongodbMemoryServer": {
      "version": "7.0.0",
      "debug": "on"
    }
  }
hasezoey commented 10 months ago

it seems like your instance is detected as amazon(not 2), which does not have binaries for mongodb version 7.0.0. mongodb 7.0.0 only has versions for amazon2 and amazon2023, i am not sure how amazons versions works or what you use.

Could you provide the output of what is mentioned here (Distribution Support template, os detection).

and maybe also try to manually force a specific url, like MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon2-7.0.0.tgz or MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-amazon2023-7.0.0.tgz

phaseharry commented 10 months ago

Here is my output:

$ cat /etc/upstream-release/lsb-release

      error: Command failed: cat /etc/upstream-release/lsb-release
      cat: /etc/upstream-release/lsb-release: No such file or directory

$ cat /etc/os-release

      NAME = 'Amazon Linux';
      VERSION = '2023';
      ID = 'amzn';
      ID_LIKE = 'fedora';
      VERSION_ID = '2023';
      PLATFORM_ID = 'platform:al2023';
      PRETTY_NAME = 'Amazon Linux 2023';
      ANSI_COLOR = '0;33';
      CPE_NAME = 'cpe:2.3:o:amazon:amazon_linux:2023';
      HOME_URL = 'https://aws.amazon.com/linux/';
      BUG_REPORT_URL = 'https://github.com/amazonlinux/amazon-linux-2023';
      SUPPORT_END = '2028-03-01';

$ cat /usr/lib/os-release

      NAME = 'Amazon Linux';
      VERSION = '2023';
      ID = 'amzn';
      ID_LIKE = 'fedora';
      VERSION_ID = '2023';
      PLATFORM_ID = 'platform:al2023';
      PRETTY_NAME = 'Amazon Linux 2023';
      ANSI_COLOR = '0;33';
      CPE_NAME = 'cpe:2.3:o:amazon:amazon_linux:2023';
      HOME_URL = 'https://aws.amazon.com/linux/';
      BUG_REPORT_URL = 'https://github.com/amazonlinux/amazon-linux-2023';
      SUPPORT_END = '2028-03-01';

$ cat /etc/lsb-release

      error: Command failed: cat /etc/lsb-release
      cat: /etc/lsb-release: No such file or directory

Forcing the binary url seems to have fixed the issue. Posted the above to help with any debugging if necessary. Thanks for all the help! 😄

github-actions[bot] commented 10 months ago

:tada: This issue has been resolved in version 9.1.0-beta.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 10 months ago

:tada: This issue has been resolved in version 9.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: