typegoose/mongodb-memory-server

Download failed for url `https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-7.0.14.tgz`

Closed this issue ยท 9 comments

Versions

  • NodeJS: 20.17.0
  • mongodb-memory-server-*: 10.1.0
  • mongodb(the binary version): 0
  • mongodb(the js package): 6.9.0
  • system: fedora 40

package: mongo-memory-server

What is the Problem?

When doing fresh npm install, memory server packet is not available from default download url

Debug Output

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-rhel80-7.0.14.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

Do you know why it happenes?

This is only guess, but 403 points that default version is not available.
https://www.mongodb.com/try/download/community-edition/releases/archive
Link on error message points same direction. There is mongo 8 and 7.0.12 but no 7.0.14.
Is it taken out?

Fix im gonna test

export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-8.0.0.tgz
export MONGOMS_VERSION=8.0.0

Test results on mongo 8.0.0

Starting the MongoMemoryServer Instance failed, enable debug log for more information. Error:
 UnexpectedCloseError: Instance closed unexpectedly with code "255" and signal "null"

So i swapped to:
MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-7.0.12.tgz
MONGOMS_VERSION=7.0.12

And it seems to fix my case.

Test results on mongo 8.0.0

for that i would need more debug logs to see what the error is (likely some kind of library problem)

https://www.mongodb.com/try/download/community-edition/releases/archive

7.0.14 is the currently latest on the 7.0 branch, which is not listed in /archive but in / ( https://www.mongodb.com/try/download/community-edition/releases/)


thanks for the report, i will try getting in contact with mongodb as they have seemingly changed, the release this time is not rhel80 but rhel8, this seemingly only applies to rhel 8 not rhel 7 or 9 (seemingly it also applies to all latest mongodb versions across 5, 6, 7 and 8, but seemingly only for the latest versions?)

TL;DR: use export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-7.0.14.tgz

Update: found a existing JIRA issue (SERVER-92375) about this, so it is intentional and we have to change.

will try to put up a fix as 10.1.1

I updated to 10.1.1 and cleaned .cache folder etc. on default it is still generating "rhel80" on local machine, but on CI/CD pipe it seems to get right one. Any ideas why?

MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "7.0.14" was found +1ms
  MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "/home/user/.cache/mongodb-binaries/mongod-x64-fedora-7.0.14" +0ms
  MongoMS:DryMongoBinary getBinaryName +0ms
  MongoMS:DryMongoBinary combineBinaryName +0ms
  MongoMS:MongoBinaryDownload startDownload +1ms
  MongoMS:MongoBinaryDownloadUrl Using "mongodb-linux-x86_64-rhel80-7.0.14.tgz" as the Archive String +0ms
  MongoMS:MongoBinaryDownloadUrl Using "https://fastdl.mongodb.org" as the mirror +0ms
  MongoMS:MongoBinaryDownload download +1ms
  MongoMS:MongoBinaryDownload download: Downloading: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-7.0.14.tgz" +1ms
  MongoMS:MongoBinaryDownload httpDownload +0ms
  MongoMS:MongoBinaryDownload httpDownload: trying to download "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-7.0.14.tgz" +0ms
  MongoMS:MongoBinary download: Removing Download lock +567ms
  MongoMS:LockFile unlock: Unlocking file "/home/user/.cache/mongodb-binaries/7.0.14.lock" +567ms
  MongoMS:LockFile checkLock: for file "/home/user/.cache/mongodb-binaries/7.0.14.lock" with uuid: "670fea52-3a78-4e1d-b734-4af3b9ef5c8a" +0ms
  MongoMS:LockFile checkLock: Lock File Already exists, and is for *this* process, with uuid: "670fea52-3a78-4e1d-b734-4af3b9ef5c8a" +1ms
  MongoMS:LockFile unlock: Lock Status was "availableInstance" for file "/home/user/.cache/mongodb-binaries/7.0.14.lock" +0ms
  MongoMS:LockFile unlockCleanup: for file "/home/user/.cache/mongodb-binaries/7.0.14.lock" +0ms
  MongoMS:MongoBinary download: Download lock removed +2ms
  MongoMS:MongoMemoryServer Mongo[unknown]: _startUpInstance threw a Error:  DownloadError: Download failed for url "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-7.0.14.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/user/github/project-to-work-on/node_modules/mongodb-memory-server-core/src/util/MongoBinaryDownload.ts:383:17)
    at RedirectableRequest.emit (node:events:519:28)
    at RedirectableRequest._processResponse (/home/user/github/project-to-work-on/node_modules/follow-redirects/index.js:409:10)
    at ClientRequest.RedirectableRequest._onNativeResponse (/home/user/github/project-to-work-on/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:709:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:551:22)
    at TLSSocket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at TLSSocket.Readable.push (node:internal/streams/readable:390:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23) {
  url: 'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-7.0.14.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'
} +574ms

on default it is still generating "rhel80" on local machine, but on CI/CD pipe it seems to get right one. Any ideas why?

sorry, the change only applied to rhel, not fedora (currently fedora handling is completely separate), will fix shortly

Seems to work now! Thanks a lot!