typegoose/mongodb-memory-server

Error when trying to run tests

Blacedraco opened this issue · 1 comments

Versions

  • NodeJS: 20.12.2
  • mongodb-memory-server-*: 6.0.4
  • mongodb(the binary version): 6.0.4
  • mongodb(the js package): 0.0.0
  • mongoose: ^8.2.4
  • system: Windows,

package: mongo-memory-server

What is your question?

If i try to run tests i get the following error Message:

Determining test suites to run...Starting the MongoMemoryServer Instance failed, enable debug log for more information. Error:
 UnexpectedCloseError: Instance closed unexpectedly with code "3221225781" and signal "null"
Exit Code is large, commonly meaning that vc_redist is not installed, the latest vc_redist can be found at https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
    at MongoInstance.closeHandler (C:...\node_modules\mongodb-memory-server-core\lib\util\MongoInstance.js:302:58)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:337:12)
Error: Instance closed unexpectedly with code "3221225781" and signal "null"
Exit Code is large, commonly meaning that vc_redist is not installed, the latest vc_redist can be found at https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
    at MongoInstance.closeHandler (C:...\node_modules\mongodb-memory-server-core\lib\util\MongoInstance.js:302:58)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:337:12)

and if i try to use a specific version with the following command,

"test": " set MONGOMS_VERSION=6.0.4 && jest --runInBand",

i get the message:

Error: Download failed for url "https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-6.0.4%20.zip", 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> (C:\...\node_modules\mongodb-memory-server-core\lib\util\MongoBinaryDownload.js:272:32)
    at RedirectableRequest.emit (node:events:518:28)
    at RedirectableRequest._processResponse (C:\...\node_modules\follow-redirects\index.js:398:10)
    at RedirectableRequest._onNativeResponse (C:\...\node_modules\follow-redirects\index.js:91:12)
    at Object.onceWrapper (node:events:633:26)
    at ClientRequest.emit (node:events:518:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:698:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:540:22)
    at TLSSocket.emit (node:events:518:28)

Neither me nor my professor have any idea how to fix it, but already tried reinstalling everything.

mongodb-memory-server-*: 6.0.4

such a mongodb-memory-server version does not exist, the last 6.0.x version is 6.0.2, in any case, 6.x is not supported anymore. currently the latest version is 9.2.0.

If i try to run tests i get the following error Message:
Neither me nor my professor have any idea how to fix it, but already tried reinstalling everything.

UnexpectedCloseError: Instance closed unexpectedly with code "3221225781" and signal "null"
Exit Code is large, commonly meaning that vc_redist is not installed, the latest vc_redist can be found at https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

did you already try what the error suggests and install the latest vc_redist package?

"test": " set MONGOMS_VERSION=6.0.4 && jest --runInBand",
Error: Download failed for url "https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-6.0.4%20.zip", Details:

something with your set command is likely wrong and adds a extra space to the environment variable (resulting in 6.0.4 ), which should (to my knowledge) not happen, though in the future i guess we can try to trim the input.
i dont know if this will work on windows, but does running MONGOMS_VERSION=6.0.4 jest --runInBand work (instead of your set and && command)?
if that does not work and this is the package.json anyway, try setting it under config, see How to use them in the package.json