From c5fe86325534c9a7cc71075d9d70d8c3e9190b34 Mon Sep 17 00:00:00 2001 From: Martin Varmuza Date: Mon, 20 May 2024 07:46:25 +0200 Subject: [PATCH] chore(connect): fw-update: add error message when binary is too small --- .../connect/src/core/onCallFirmwareUpdate.ts | 31 +++++++++++++------ packages/suite-web/src/index.ts | 2 ++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/packages/connect/src/core/onCallFirmwareUpdate.ts b/packages/connect/src/core/onCallFirmwareUpdate.ts index 3977270d8aca..a51cb7849cdf 100644 --- a/packages/connect/src/core/onCallFirmwareUpdate.ts +++ b/packages/connect/src/core/onCallFirmwareUpdate.ts @@ -202,17 +202,28 @@ const getBinaryHelper = ( version: device.firmwareRelease.release.version, btcOnly, intermediaryVersion, - }).then(res => { - postMessage( - createUiMessage(UI.FIRMWARE_PROGRESS, { - device: device.toMessageObject(), - operation: 'downloading', - progress: 100, - }), - ); + }) + .then(res => { + console.log('res.byteLength', res.byteLength); + // suspiciously small binary. this typically happens when build does not have git lfs enabled and all + // you download here are some pointers to lfs objects + if (res.byteLength < 1000) { + throw ERRORS.TypedError('Runtime', 'Firmware binary is too small'); + } - return res; - }); + return res; + }) + .then(res => { + postMessage( + createUiMessage(UI.FIRMWARE_PROGRESS, { + device: device.toMessageObject(), + operation: 'downloading', + progress: 100, + }), + ); + + return res; + }); }; const firmwareCheck = async ( diff --git a/packages/suite-web/src/index.ts b/packages/suite-web/src/index.ts index 588a4f8068ea..f0266cdf4d72 100644 --- a/packages/suite-web/src/index.ts +++ b/packages/suite-web/src/index.ts @@ -20,3 +20,5 @@ observer.observe(document.body, { }); export {}; + +console.log('trigger build');