diff --git a/src/helpers/deviceId.ts b/src/helpers/deviceId.ts index 1282e1b79..758a1ae20 100644 --- a/src/helpers/deviceId.ts +++ b/src/helpers/deviceId.ts @@ -1,5 +1,4 @@ import { getDeviceId } from "@mongodb-js/device-id"; -import * as nodeMachineId from "node-machine-id"; import type { LoggerBase } from "../common/logger.js"; import { LogId } from "../common/logger.js"; @@ -17,7 +16,11 @@ export class DeviceId { private constructor(logger: LoggerBase, timeout: number = DEVICE_ID_TIMEOUT) { this.logger = logger; this.timeout = timeout; - this.getMachineId = (): Promise => nodeMachineId.machineId(true); + this.getMachineId = async (): Promise => { + const nodeMachineId = await import("node-machine-id"); + const machineId = nodeMachineId.default?.machineId || nodeMachineId.machineId; + return machineId(true); + }; this.abortController = new AbortController(); this.deviceIdPromise = DeviceId.UnknownDeviceId;