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.58k stars 187 forks source link

Download failed for RHEL 8.0 URLs #896

Closed tomhudak closed 1 hour ago

tomhudak commented 3 hours ago

Versions

package: mongo-memory-server

What is the Problem?

Download of the server version failed. I tried to change the version to 8.0.0 and 7.0.14 and I get the same error (this is what I think was fixed in https://github.com/typegoose/mongodb-memory-server/releases/tag/v10.1.2).

First it worked with 7.0.14, but then I have deleted my node_modules folder to make sure cache does not interact with it and then it consistently failed.

Debug Output

Debug Output ```txt Error: Download failed for url "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-8.0.1.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. (/home/tomi/git/urbantz/server/node_modules/@shelf/jest-mongodb/node_modules/mongodb-memory-server-core/lib/util/MongoBinaryDownload.js:272:32) at RedirectableRequest.emit (node:events:519:28) at RedirectableRequest._processResponse (/home/tomi/git/urbantz/server/node_modules/follow-redirects/index.js:409:10) at RedirectableRequest._onNativeResponse (/home/tomi/git/urbantz/server/node_modules/follow-redirects/index.js:102:12) at Object.onceWrapper (node:events:634:26) at ClientRequest.emit (node:events:519:28) at HTTPParser.parserOnIncomingClient (node:_http_client:702:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:118:17) at TLSSocket.socketOnData (node:_http_client:544:22) at TLSSocket.emit (node:events:519:28) ```

Do you know why it happens?

While resolving the fedora version, it is trying to download from https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-8.0.1.tgz (with 80) while the correct url is https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-8.0.1.tgz (with 8 only).

Workaround

Before running my code, I set

export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-8.0.1.tgz
hasezoey commented 2 hours ago

I dont quite understand what you want to say with this issue. Are you meaning to say that you still have a URL issue with 80 being used despite using 10.1.2 on fedora 40?

If that is the case, could you provide debug logs and Distribution information?

PS: i have added a test for fedora 40 & mongodb 8.0.1 now 1cd516f5b9497f50f14a047dceaaa7be8028dc99 - no issues there

tomhudak commented 1 hour ago

Thanks for getting back to me quickly.

Are you meaning to say that you still have a URL issue with 80 being used despite using 10.1.2 on fedora 40? Exactly, that's my problem, and I'm happy for any advice to reset my environment or to point me to a direction I haven't tried yet.

You can find the debug logs here and the Distribution Information here.

Thank you!

EDIT: comparing the debug logs to the test you have added, I can see that the same values were specified, so I'm not sure about the issue.

 version: '8.0.1',
  os: {
    os: 'linux',
    dist: 'fedora',
    codename: '""',
    release: '40',
    id_like: undefined
  },
hasezoey commented 1 hour ago

You can find the debug logs here MongoMS:GetPort EXP_NET0LISTEN false +0ms

guessing by that line, you are running a mongodb-memory-server version before 10.0.0, see 887f1a1e932a8993ef3fd69cf1f65b700c89a77b.

verify you package.json that you are specifying the correct version, then double-check your lockfile

tomhudak commented 1 hour ago

In my project I'm using https://www.npmjs.com/package/@shelf/jest-mongodb that still depend on mongodb-memory-server 9.2.0, I think that will be the source of my issue.

Thanks for the help, I continue my journey with them.