From 2d092cbc98bde73101fa0cfa9ae0766226dddaf4 Mon Sep 17 00:00:00 2001 From: Adam Wootton Date: Wed, 3 Jul 2024 12:39:43 -0400 Subject: [PATCH] config helper undefined check --- sdk/nodejs/src/client.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/nodejs/src/client.ts b/sdk/nodejs/src/client.ts index 81069fcdc..e3e662868 100644 --- a/sdk/nodejs/src/client.ts +++ b/sdk/nodejs/src/client.ts @@ -56,7 +56,7 @@ export class DevCycleClient { private clientUUID: string private hostname: string private sdkKey: string - private configHelper: EnvironmentConfigManager + private configHelper?: EnvironmentConfigManager private clientConfigHelper?: EnvironmentConfigManager private eventQueue: EventQueue private onInitialized: Promise @@ -235,7 +235,7 @@ export class DevCycleClient { ) const populatedUser = DVCPopulatedUserFromDevCycleUser(incomingUser) - if (!this.configHelper.hasConfig) { + if (!this.configHelper?.hasConfig) { this.logger.warn( 'variable called before DevCycleClient has config, returning default value', ) @@ -290,7 +290,7 @@ export class DevCycleClient { allVariables(user: DevCycleUser): DVCVariableSet { const incomingUser = castIncomingUser(user) - if (!this.configHelper.hasConfig) { + if (!this.configHelper?.hasConfig) { this.logger.warn( 'allVariables called before DevCycleClient has config', ) @@ -309,7 +309,7 @@ export class DevCycleClient { allFeatures(user: DevCycleUser): DVCFeatureSet { const incomingUser = castIncomingUser(user) - if (!this.configHelper.hasConfig) { + if (!this.configHelper?.hasConfig) { this.logger.warn( 'allFeatures called before DevCycleClient has config', ) @@ -435,7 +435,7 @@ export class DevCycleClient { async close(): Promise { await this.onInitialized await this.flushEvents() - this.configHelper.cleanup() + this.configHelper?.cleanup() this.eventQueue.cleanup() clearInterval(this.bucketingTracker) }