From a2f82716d1a658b5365f9401efc771efe1445ea5 Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Mon, 16 Dec 2024 12:11:48 +0200 Subject: [PATCH] fix: now null sdks will also be handled nicely (#8984) We had some error logs, that when SDK is null, then the application overview query was failing. This solves it --- src/lib/db/client-applications-store.ts | 6 +++--- .../spec/application-environment-instances-schema.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/db/client-applications-store.ts b/src/lib/db/client-applications-store.ts index 94ca9480d589..4668357defca 100644 --- a/src/lib/db/client-applications-store.ts +++ b/src/lib/db/client-applications-store.ts @@ -325,7 +325,7 @@ export default class ClientApplicationsStore 'COUNT(DISTINCT ci.instance_id) as unique_instance_count', ), this.db.raw( - 'ARRAY_AGG(DISTINCT ci.sdk_version) as sdk_versions', + 'ARRAY_AGG(DISTINCT ci.sdk_version) FILTER (WHERE ci.sdk_version IS NOT NULL) as sdk_versions', ), this.db.raw('MAX(ci.last_seen) as latest_last_seen'), ]) @@ -394,7 +394,7 @@ export default class ClientApplicationsStore env = { name: environment, instanceCount: Number(unique_instance_count), - sdks: sdk_versions, + sdks: sdk_versions || [], lastSeen: latest_last_seen, issues: { missingFeatures: featuresNotMappedToProject @@ -412,7 +412,7 @@ export default class ClientApplicationsStore return acc; }, []); environments.forEach((env) => { - env.sdks?.sort(); + env.sdks.sort(); }); return { diff --git a/src/lib/openapi/spec/application-environment-instances-schema.ts b/src/lib/openapi/spec/application-environment-instances-schema.ts index fbac9b89b795..eb8783626d0e 100644 --- a/src/lib/openapi/spec/application-environment-instances-schema.ts +++ b/src/lib/openapi/spec/application-environment-instances-schema.ts @@ -24,6 +24,7 @@ export const applicationEnvironmentInstancesSchema = { }, sdkVersion: { type: 'string', + nullable: true, description: 'An SDK version identifier. Usually formatted as "unleash-client-:"', example: 'unleash-client-java:7.0.0',