From b6a71947ab4a0a9d9466e5d0e0c01cfb7e035f9b Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 15 Aug 2023 17:30:49 +0200 Subject: [PATCH] fix(node): More relevant warning message when tracing extensions are missing --- packages/core/src/hub.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/core/src/hub.ts b/packages/core/src/hub.ts index ea4f955ec681..5961529be687 100644 --- a/packages/core/src/hub.ts +++ b/packages/core/src/hub.ts @@ -374,11 +374,19 @@ export class Hub implements HubInterface { const result = this._callExtensionMethod('startTransaction', context, customSamplingContext); if (__DEBUG_BUILD__ && !result) { - // eslint-disable-next-line no-console - console.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init': + const client = this.getClient(); + if (!client) { + // eslint-disable-next-line no-console + console.warn( + "Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'", + ); + } else { + // eslint-disable-next-line no-console + console.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init': Sentry.addTracingExtensions(); Sentry.init({...}); `); + } } return result;