Fix issues with possible null providerId

This commit is contained in:
Owen
2026-08-13 11:04:11 -04:00
parent a2f5d830d6
commit e92bb9043b
3 changed files with 33 additions and 9 deletions
+11 -2
View File
@@ -208,7 +208,14 @@ async function enrichWithDetails(
type: aiProviders.type
})
.from(aiProviders)
.where(inArray(aiProviders.providerId, providerIds));
.where(
inArray(
aiProviders.providerId,
providerIds.filter(
(id): id is number => id !== null && id !== undefined
)
)
);
for (const p of providerDetails) {
providerMap.set(p.providerId, { name: p.name, type: p.type });
@@ -336,7 +343,9 @@ async function enrichWithDetails(
}
return logs.map((log) => {
const provider = providerMap.get(log.providerId);
const provider = log.providerId
? providerMap.get(log.providerId)
: null;
let resourceId = log.resourceId;
let resourceName: string | null = null;