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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e4a3696fd5
commit
c97cf6eaf8
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user