mongodb-memory-server: Could not download version other than default (Error: connect ECONNREFUSED 127.0.0.1:443)

Versions

  • NodeJS: v14.16.0
  • mongodb-memory-server-*: 8.2.0
  • mongodb(the binary version): 4.2.10 (but any other than 5.0.3 as well)
  • mongodb(the js package): 3.5.5
  • mongoose: 5.9.6
  • system: MacOS (Big Sur 11.6)

package: mongodb-memory-server

What is the Problem?

When running our jest tests, we try to set a specific version 4.2.10 to use the same version as on our infrastructure. After upgrading the mongodb-memory-server package to version 8.2.0 we run into issues and binaries are not downloaded. Error Error: connect ECONNREFUSED 127.0.0.1:443 is thrown.

Code Example

package.json config:

{
...
"config": {
    "mongodbMemoryServer": {
      "debug": 1,
      "version": "4.2.10",
      "downloadDir": "../../common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries"
    }
  }
}

Code:

  const mongod = new MongoMemoryServer();

  await mongod.start();

  const mongodConnectionUri = await mongod.getUri();

Debug Output

Debug Output
Running "run:jest" (run) task
2022-01-20T10:30:09.659Z MongoMS:ResolveConfig Debug Mode Enabled, through package.json
2022-01-20T10:30:09.875Z MongoMS:MongoMemoryServer Mongo[unknown]: start: Called .start() method
2022-01-20T10:30:09.875Z MongoMS:MongoMemoryServer Mongo[unknown]: _startUpInstance: Called MongoMemoryServer._startUpInstance() method
2022-01-20T10:30:09.875Z MongoMS:MongoMemoryServer Mongo[unknown]: getStartOptions: forceSamePort: true
2022-01-20T10:30:09.879Z MongoMS:MongoMemoryServer Mongo[unknown]: _startUpInstance: Creating new MongoDB instance with options: {
  instance: {
    port: 63716,
    dbName: '',
    ip: '127.0.0.1',
    storageEngine: 'ephemeralForTest',
    replSet: undefined,
    dbPath: '/var/folders/94/3vjl21z903qgj1q61hb7dn5w0000gp/T/mongo-mem--37228-QqvjoQcXRJUO',
    tmpDir: {
      name: '/var/folders/94/3vjl21z903qgj1q61hb7dn5w0000gp/T/mongo-mem--37228-QqvjoQcXRJUO',
      removeCallback: [Function: _cleanupCallback]
    },
    args: undefined,
    auth: undefined
  },
  binary: {
    downloadDir: '/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries'
  },
  spawn: undefined
}
2022-01-20T10:30:09.881Z MongoMS:MongoInstance create: Called .create() method
2022-01-20T10:30:09.881Z MongoMS:MongoInstance Mongo[63716]: start
2022-01-20T10:30:09.881Z MongoMS:MongoBinary getPath
2022-01-20T10:30:09.881Z MongoMS:DryMongoBinary generateOptions
2022-01-20T10:30:09.881Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
2022-01-20T10:30:09.882Z MongoMS:DryMongoBinary generatePaths {
  version: '4.2.10',
  downloadDir: '/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries',
  os: { os: 'darwin' },
  arch: 'x64',
  systemBinary: ''
}
2022-01-20T10:30:09.882Z MongoMS:DryMongoBinary getBinaryName
2022-01-20T10:30:09.882Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.882Z MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty
2022-01-20T10:30:09.882Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.882Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.882Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
  legacyHomeCache: '/Users/pipo93/.cache/mongodb-binaries/mongod-x64-darwin-4.2.10',
  modulesCache: '',
  relative: '/Users/pipo93/projects/monorepo/apps/application/mongodb-binaries/mongod-x64-darwin-4.2.10',
  resolveConfig: '/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/mongod-x64-darwin-4.2.10'
} 
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.2.10" was found
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/mongod-x64-darwin-4.2.10"
2022-01-20T10:30:09.884Z MongoMS:MongoBinary getPath: MongoBinary options: {
  "version": "4.2.10",
  "downloadDir": "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries",
  "os": {
    "os": "darwin"
  },
  "arch": "x64",
  "systemBinary": "",
  "platform": "darwin",
  "checkMD5": false
}
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary locateBinary: Trying to locate Binary for version "4.2.10"
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary generateOptions
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary generatePaths {
  version: '4.2.10',
  downloadDir: '/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries',
  os: { os: 'darwin' },
  arch: 'x64',
  systemBinary: ''
}
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary getBinaryName
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.884Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
  legacyHomeCache: '/Users/pipo93/.cache/mongodb-binaries/mongod-x64-darwin-4.2.10',
  modulesCache: '',
  relative: '/Users/pipo93/projects/monorepo/apps/application/mongodb-binaries/mongod-x64-darwin-4.2.10',
  resolveConfig: '/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/mongod-x64-darwin-4.2.10'
} 
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.2.10" was found
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/mongod-x64-darwin-4.2.10"
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary locateBinary: running generateDownloadPath
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary generatePaths {
  version: '4.2.10',
  downloadDir: '/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries',
  os: { os: 'darwin' },
  arch: 'x64',
  systemBinary: ''
}
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary getBinaryName
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
  legacyHomeCache: '/Users/pipo93/.cache/mongodb-binaries/mongod-x64-darwin-4.2.10',
  modulesCache: '',
  relative: '/Users/pipo93/projects/monorepo/apps/application/mongodb-binaries/mongod-x64-darwin-4.2.10',
  resolveConfig: '/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/mongod-x64-darwin-4.2.10'
} 
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.2.10" was found
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/mongod-x64-darwin-4.2.10"
2022-01-20T10:30:09.885Z MongoMS:DryMongoBinary locateBinary: could not find a existing binary
2022-01-20T10:30:09.885Z MongoMS:MongoBinary getPath: "RUNTIME_DOWNLOAD" is "true", trying to download
2022-01-20T10:30:09.885Z MongoMS:MongoBinary download
2022-01-20T10:30:09.886Z MongoMS:MongoBinary download: Waiting to acquire Download lock for file "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.10.lock"
2022-01-20T10:30:09.886Z MongoMS:LockFile lock: Locking file "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.10.lock"
2022-01-20T10:30:09.886Z MongoMS:LockFile checkLock: for file "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.10.lock" with uuid: "undefined"
2022-01-20T10:30:09.886Z MongoMS:LockFile createLock: trying to create a lock file for "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.10.lock"
2022-01-20T10:30:09.887Z MongoMS:LockFile createLock: Lock File Created for file "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.10.lock"
2022-01-20T10:30:09.887Z MongoMS:MongoBinary download: Download lock acquired
2022-01-20T10:30:09.887Z MongoMS:MongoBinary download: Adding version 4.2.10 to cache
2022-01-20T10:30:09.887Z MongoMS:MongoBinaryDownload getMongodPath
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary generateOptions
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary generatePaths {
  version: '4.2.10',
  downloadDir: '/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries',
  os: { os: 'darwin' },
  arch: 'x64',
  systemBinary: ''
}
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary getBinaryName
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
  legacyHomeCache: '/Users/pipo93/.cache/mongodb-binaries/mongod-x64-darwin-4.2.10',
  modulesCache: '',
  relative: '/Users/pipo93/projects/monorepo/apps/application/mongodb-binaries/mongod-x64-darwin-4.2.10',
  resolveConfig: '/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/mongod-x64-darwin-4.2.10'
} 
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.2.10" was found
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/mongod-x64-darwin-4.2.10"
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary getBinaryName
2022-01-20T10:30:09.888Z MongoMS:DryMongoBinary combineBinaryName
2022-01-20T10:30:09.888Z MongoMS:MongoBinaryDownload startDownload
2022-01-20T10:30:09.889Z MongoMS:MongoBinaryDownloadUrl Using "mongodb-macos-x86_64-4.2.10.tgz" as the Archive String
2022-01-20T10:30:09.889Z MongoMS:MongoBinaryDownloadUrl Using "https://fastdl.mongodb.org" as the mirror
2022-01-20T10:30:09.889Z MongoMS:MongoBinaryDownload download
2022-01-20T10:30:09.889Z MongoMS:MongoBinaryDownload download: Downloading: "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.10.tgz"
2022-01-20T10:30:09.889Z MongoMS:MongoBinaryDownload httpDownload
2022-01-20T10:30:09.890Z MongoMS:MongoBinaryDownload httpDownload: trying to download "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.10.tgz"
Couldnt download "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.10.tgz"! connect ECONNREFUSED 127.0.0.1:443
2022-01-20T10:30:09.904Z MongoMS:MongoBinary download: Removing Download lock
2022-01-20T10:30:09.904Z MongoMS:LockFile unlock: Unlocking file "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.10.lock"
2022-01-20T10:30:09.904Z MongoMS:LockFile checkLock: for file "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.10.lock" with uuid: "ed7af13a-0b49-4983-a528-5743d4fe15ea"
2022-01-20T10:30:09.905Z MongoMS:LockFile checkLock: Lock File Already exists, and is for *this* process, with uuid: "ed7af13a-0b49-4983-a528-5743d4fe15ea"
2022-01-20T10:30:09.905Z MongoMS:LockFile unlock: Lock Status was "availableInstance" for file "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.10.lock"
2022-01-20T10:30:09.905Z MongoMS:LockFile unlockCleanup: for file "/Users/pipo93/projects/monorepo/common/temp/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.10.lock"
2022-01-20T10:30:09.905Z MongoMS:MongoBinary download: Download lock removed
2022-01-20T10:30:09.905Z MongoMS:MongoMemoryServer Mongo[unknown]: stop: Called .stop() method
2022-01-20T10:30:09.905Z MongoMS:MongoMemoryServer Mongo[unknown]: stop: "instanceInfo" is not defined (never ran?)
Error: connect ECONNREFUSED 127.0.0.1:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
Warning: non-zero exit code 1 Use --force to continue.

Aborted due to warnings.

Do you know why it happenes?

no

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19

Most upvoted comments