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

Ubuntu >= 22.04 is unsupported when using MongoDB >= 6.0.4 #846

Closed gnarea closed 7 months ago

gnarea commented 7 months ago
Error: Download failed for url "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2304-6.0.11.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/gus/repos/awala-keystore-cloud-js/node_modules/mongodb-memory-server-core/src/util/MongoBinaryDownload.ts:383:17)
    at RedirectableRequest.emit (node:events:512:28)
    at RedirectableRequest.Object.<anonymous>.RedirectableRequest._processResponse (/home/gus/repos/awala-keystore-cloud-js/node_modules/follow-redirects/index.js:397:10)
    at ClientRequest.RedirectableRequest._onNativeResponse (/home/gus/repos/awala-keystore-cloud-js/node_modules/follow-redirects/index.js:90:12)
    at Object.onceWrapper (node:events:627:26)
    at ClientRequest.emit (node:events:512:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:693:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:535:22)
    at TLSSocket.emit (node:events:512:28)
    at addChunk (node:internal/streams/readable:343:12)
    at readableAddChunk (node:internal/streams/readable:316:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:253:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)

Due to:

https://github.com/nodkz/mongodb-memory-server/blob/9042eb238842fc4f66fea3c1a1c609df27164370/packages/mongodb-memory-server-core/src/util/MongoBinaryDownloadUrl.ts#L564-L570

Would you accept a PR that caps the Ubuntu version at 22.04 when using >= MongoDB 6.0.4? Per https://www.mongodb.com/download-center/community/releases/archive

hasezoey commented 7 months ago

please follow a proper template, either "distribution support" or "bug report".

from the description and title i am not sure what issue i am looking at, the url in the error mentions usage of ubuntu2304 but the issue seems to be about 2204; also the mentioned code does not look wrong because it is for ubuntu versions above 21(04) AND requesting a mongodb version below 6.0.4

gnarea commented 7 months ago

please follow a proper template, either "distribution support" or "bug report".

Sorry, I didn't get the option to do that because I started the issue from the source code ("Reference in new issue").

from the description and title i am not sure what issue i am looking at, the url in the error mentions usage of ubuntu2304 but the issue seems to be about 2204;

You're seeing ubuntu2304 because of the code I cited above -- I'm actually running Ubuntu 23.10.

But like I said above, I believe the issue affects Ubuntu 22.04, not just the version I'm running.

also the mentioned code does not look wrong because it is for ubuntu versions above 21(04) AND requesting a mongodb version below 6.0.4

Indeed, but what if I want MongoDB => 6.0.4? It returns ubuntu2304, which is unsupported.

hasezoey commented 7 months ago

Indeed, but what if I want MongoDB => 6.0.4? It returns ubuntu2304, which is unsupported.

true, so basically this issue is about that versions above 2204 (like 2304 and 2404) should be clamped to 2204, at least until 2204 comes out and mongodb adds binaries

workaround for now is to use the DISTRO config option to set it to ubuntu-22.04

github-actions[bot] commented 7 months ago

:tada: This issue has been resolved in version 9.1.6-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

gnarea commented 7 months ago

Thanks @hasezoey! the fix you pushed works for me. Should I close this issue now, or you want to keep it around until the final 9.1.6 release?

hasezoey commented 7 months ago

Should I close this issue now, or you want to keep it around until the final 9.1.6 release?

you can keep it around, it will be automatically closed once merged into master, i just wanted to confirm if i understood this issue first

github-actions[bot] commented 7 months ago

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

The release is available on:

Your semantic-release bot :package::rocket: