Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting the MongoMemoryServer Instance failed #904

Open
zhenl opened this issue Dec 12, 2024 · 1 comment
Open

Starting the MongoMemoryServer Instance failed #904

zhenl opened this issue Dec 12, 2024 · 1 comment

Comments

@zhenl
Copy link

zhenl commented Dec 12, 2024

Versions

  • NodeJS: 20.10.0
  • mongodb-memory-server-*:10.1.2
  • mongodb(the binary version): 0.0.0
  • mongodb(the js package): 6.9.0
  • system: Windows 11

package: mongo-memory-server

What is the Problem?

When I used mongodb-memory-server in mocha tests, I met below error:

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 (D:\BDD\flowDDD\verificationsrc-main\node_modules\mongodb-memory-server-core\lib\util\MongoInstance.js:303:58)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

Code Example

const { MongoMemoryServer } = require('mongodb-memory-server')
var MongoClient = require('mongodb').MongoClient;
var assert = require('assert');
describe('test', function () {
    let mongoServer;
    before(async function () {
        mongoServer = await MongoMemoryServer.create();
        var mongodb = await MongoClient.connect(mongoUri);
        var dbase = mongodb.db("testdb");
        const collectionName ="test"
        const rows =[{name:'test1'},{name:'test2'}]
        var collection = dbase.collection(collectionName);
        const result = await collection.insertMany(rows)
       await mongodb.close()
    });

Debug Output

Debug Output
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 (D:\BDD\flowDDD\verificationsrc-main\node_modules\mongodb-memory-server-core\lib\util\MongoInstance.js:303:58)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

Do you know why it happenes?

no

@zhenl zhenl added the bug label Dec 12, 2024
@hasezoey
Copy link
Member

Did you follow the advice and install the latest vc_redist?

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants