Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Add logging for "Attempted to build clientId with invalid app" event
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mweststrate authored and facebook-github-bot committed Feb 4, 2022
1 parent e4a3696 commit c97cf6e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions desktop/flipper-common/src/clientUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c97cf6e

Please sign in to comment.