shelfio / jest-mongodb

Jest preset for MongoDB in-memory server
MIT License
591 stars 83 forks source link

Not working on Ubuntu 23.04 #455

Open Krigan112 opened 8 months ago

Krigan112 commented 8 months ago

I tried to run tests after installing ubuntu 23.04, and I'm getting this error :

Determining test suites to run...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-ubuntu2304-6.0.9.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
    at RedirectableRequest.<anonymous> (/home/krigan/amlf-analyst/node_modules/mongodb-memory-server-core/src/util/MongoBinaryDownload.ts:383:17)
    at RedirectableRequest.emit (node:events:513:28)
    at RedirectableRequest.emit (node:domain:489:12)
    at RedirectableRequest._processResponse (/home/krigan/amlf-analyst/node_modules/follow-redirects/index.js:368:10)
    at ClientRequest.RedirectableRequest._onNativeResponse (/home/krigan/amlf-analyst/node_modules/follow-redirects/index.js:65:10)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:513:28)
    at ClientRequest.emit (node:domain:489:12)
    at HTTPParser.parserOnIncomingClient (node:_http_client:695:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17) {
  url: 'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2304-6.0.9.tgz',
  msg: "Status Code is 403 (MongoDB's 404)\n" +
    "This means that the requested version-platform combination doesn't exist\n" +
    "Try to use different version 'new MongoMemoryServer({ binary: { version: 'X.Y.Z' } })'\n" +
    'List of available versions can be found here: https://www.mongodb.com/download-center/community/releases/archive'
}

After searching for another version of MongoMemoryServer, I found out that there is no support for Ubuntu 23.04 for now. Does anyone knows if there will be a version that supports it ?

Krigan112 commented 8 months ago

This pull request should fix the issue : https://github.com/shelfio/jest-mongodb/pull/451 As explained in this issue from mongo-memory-server : https://github.com/nodkz/mongodb-memory-server/issues/846

For now, I found a workaround by editing my package.json to add this :

"config": {
    "mongodbMemoryServer": {
      "downloadUrl": "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.9.tgz"
    }
  }

It still works even if I'm on Ubuntu 23.10 now.

mguay22 commented 7 months ago

I've seeing the same issue, thanks for the workaround. Hopefully this can be merged in soon.

aclarembeau commented 6 months ago

+1 , that would be nice to have this one merged, as the workaround doesn't work for teams not only made of linux users