From c2170f9fad6a4f453f21bd73d90f267f16fe78a7 Mon Sep 17 00:00:00 2001 From: Liza K Date: Tue, 14 Sep 2021 16:50:44 +0300 Subject: [PATCH] cr 2 --- x-pack/plugins/cloud/public/plugin.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/cloud/public/plugin.ts b/x-pack/plugins/cloud/public/plugin.ts index b2842b4acb3a2..49f8abc5ea59a 100644 --- a/x-pack/plugins/cloud/public/plugin.ts +++ b/x-pack/plugins/cloud/public/plugin.ts @@ -44,7 +44,6 @@ export interface CloudConfigType { interface CloudSetupDependencies { home?: HomePublicPluginSetup; security?: Pick; - application?: Promise; } interface CloudStartDependencies { @@ -63,13 +62,14 @@ export interface CloudSetup { } interface SetupFullstoryDeps extends CloudSetupDependencies { + application?: Promise; basePath: IBasePath; } export class CloudPlugin implements Plugin { private config!: CloudConfigType; private isCloudEnabled: boolean; - private appSubscription: Subscription; + private appSubscription?: Subscription; constructor(private readonly initializerContext: PluginInitializerContext) { this.config = this.initializerContext.config.get(); @@ -211,8 +211,8 @@ export class CloudPlugin implements Plugin { if (userId) { // Do the hashing here to keep it at clear as possible in our source code that we do not send literal user IDs const hashedId = sha256(userId.toString()); - application?.then(async () => { - try { + application + ?.then(async () => { const appStart = await application; this.appSubscription = appStart.currentAppId$.subscribe((appId) => { // Update the current application every time it changes @@ -220,15 +220,15 @@ export class CloudPlugin implements Plugin { app_id_str: appId ?? 'unknown', }); }); - } catch (e) { + }) + .catch((e) => { // eslint-disable-next-line no-console console.error( `[cloud.full_story] Could not retrieve application service due to error: ${e.toString()}`, e ); - } - }); - const kibanaVer = this.initializerContext.env.packageInfo.version ?? null; + }); + const kibanaVer = this.initializerContext.env.packageInfo.version; const parsedVer = parse(kibanaVer); // `str` suffix is required for evn vars, see docs: https://help.fullstory.com/hc/en-us/articles/360020623234 fullStory.identify(hashedId, {