diff --git a/.changeset/honest-eels-shave.md b/.changeset/honest-eels-shave.md new file mode 100644 index 000000000..5a87d490c --- /dev/null +++ b/.changeset/honest-eels-shave.md @@ -0,0 +1,5 @@ +--- +"@ledgerhq/device-transport-kit-web-ble": patch +--- + +Fix Chrome windows ble connect diff --git a/packages/tools/esbuild-tools/build.mjs b/packages/tools/esbuild-tools/build.mjs index 0ef3676dd..ba68115be 100755 --- a/packages/tools/esbuild-tools/build.mjs +++ b/packages/tools/esbuild-tools/build.mjs @@ -1,10 +1,15 @@ #!/usr/bin/env zx import "zx/globals"; +import { usePowerShell } from "zx"; import esbuild from "esbuild"; import { nodeExternalsPlugin } from "esbuild-node-externals"; import { replaceTscAliasPaths } from "tsc-alias"; +if (process.platform === "win32") { + usePowerShell(); +} + const config = { minify: true, bundle: false, diff --git a/packages/transport/web-ble/src/api/transport/WebBleTransport.ts b/packages/transport/web-ble/src/api/transport/WebBleTransport.ts index e30d43d0e..ac5d3dbcd 100644 --- a/packages/transport/web-ble/src/api/transport/WebBleTransport.ts +++ b/packages/transport/web-ble/src/api/transport/WebBleTransport.ts @@ -255,7 +255,12 @@ export class WebBleTransport implements Transport { ); return discoveredDevice; } catch (error) { - await bleDevice.forget(); + this._logger.error("Error while discovering device", { + data: { error, bleDevice }, + }); + if (bleDevice.forget) { + await bleDevice.forget(); + } throw error; } }).caseOf({ @@ -350,8 +355,9 @@ export class WebBleTransport implements Transport { return Right(connectedDevice); } catch (error) { - await internalDevice.bleDevice.forget(); - + if (internalDevice.bleDevice.forget) { + await internalDevice.bleDevice.forget(); + } this._internalDevicesById.delete(deviceId); this._logger.error("Error while getting characteristics", {