From d2b378b98abd26b00e240102f6ec77010cb47328 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 3 Nov 2020 17:03:01 +0100 Subject: [PATCH] fix(Analytics): Ensure to send payload when having all meta --- lib/plugins/deploy/deploy.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/plugins/deploy/deploy.js b/lib/plugins/deploy/deploy.js index de9efb197675..2f69415f1827 100644 --- a/lib/plugins/deploy/deploy.js +++ b/lib/plugins/deploy/deploy.js @@ -114,14 +114,14 @@ class Deploy { }); } - this.deferredBackendNotificationRequest = analyticsReport( - Object.assign(generateAnalyticsPayload(this.serverless), { command: 'deploy' }) - ); - - if (!this.options.package && !this.serverless.service.package.path) { - return this.serverless.pluginManager.spawn('package'); - } - return null; + return (!this.options.package && !this.serverless.service.package.path + ? BbPromise.resolve(this.serverless.pluginManager.spawn('package')) + : BbPromise.resolve() + ).finally(() => { + this.deferredBackendNotificationRequest = analyticsReport( + Object.assign(generateAnalyticsPayload(this.serverless), { command: 'deploy' }) + ); + }); }), 'after:deploy:finalize': () => { if (!this.deferredBackendNotificationRequest) return null;