diff --git a/ts/sql/Client.ts b/ts/sql/Client.ts index 21f8b16a4..95134488c 100644 --- a/ts/sql/Client.ts +++ b/ts/sql/Client.ts @@ -383,13 +383,7 @@ const ITEM_SPECS: Partial> = { senderCertificate: ['value.serialized'], senderCertificateNoE164: ['value.serialized'], subscriberId: ['value'], - usernameLink: { - key: 'value', - valueSpec: { - isMap: true, - valueSpec: ['entropy', 'serverId'], - }, - }, + usernameLink: ['value.entropy', 'value.serverId'], }; async function createOrUpdateItem( data: ItemType @@ -414,7 +408,12 @@ async function getItemById( const spec = ITEM_SPECS[id]; const data = await channels.getItemById(id); - return spec ? specToBytes(spec, data) : (data as unknown as ItemType); + try { + return spec ? specToBytes(spec, data) : (data as unknown as ItemType); + } catch (error) { + log.warn(`getItemById(${id}): Failed to parse item from spec`, error); + return undefined; + } } async function getAllItems(): Promise { const items = await channels.getAllItems();