From c97cf6eaf83b7c49469b0a29d105a2b5b7b8b3bd Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Fri, 4 Feb 2022 01:14:01 -0800 Subject: [PATCH] Add logging for "Attempted to build clientId with invalid app" event Summary: The `Error: Attempted to build clientId with invalid app: "` event shows up in our monitoring regularly, but it is unclear which kind of app is trying to connect, so adding some more info to the error, to be able to pin point it better a next time Reviewed By: lawrencelomax Differential Revision: D33982871 fbshipit-source-id: 34c2612a9fe86a6815f1cc655f6def1f734e4b1e --- desktop/flipper-common/src/clientUtils.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/desktop/flipper-common/src/clientUtils.tsx b/desktop/flipper-common/src/clientUtils.tsx index 48a49c4c4..5341d3b1b 100644 --- a/desktop/flipper-common/src/clientUtils.tsx +++ b/desktop/flipper-common/src/clientUtils.tsx @@ -43,18 +43,19 @@ export function buildClientId(clientInfo: { device: string; device_id: string; }): string { + const escapedName = escape(clientInfo.app); + const result = `${escapedName}#${clientInfo.os}#${clientInfo.device}#${clientInfo.device_id}`; // N.B.: device_id can be empty, which designates the host device for (const key of ['app', 'os', 'device'] as Array< keyof ClientIdConstituents >) { if (!clientInfo[key]) { console.error( - `Attempted to build clientId with invalid ${key}: "${clientInfo[key]}`, + `Attempted to build clientId with invalid ${key}: "${clientInfo[key]} (identifier: ${result})`, ); } } - const escapedName = escape(clientInfo.app); - return `${escapedName}#${clientInfo.os}#${clientInfo.device}#${clientInfo.device_id}`; + return result; } export function deconstructClientId(clientId: string): ClientIdConstituents {