diff --git a/packages/core/src/asyncContext/stackStrategy.ts b/packages/core/src/asyncContext/stackStrategy.ts index 4ec7445d1b3e..05160d685e89 100644 --- a/packages/core/src/asyncContext/stackStrategy.ts +++ b/packages/core/src/asyncContext/stackStrategy.ts @@ -132,9 +132,13 @@ export class AsyncContextStack { */ function getAsyncContextStack(): AsyncContextStack { const registry = getMainCarrier(); + + // For now we continue to keep this as `hub` on the ACS, + // as e.g. the Loader Script relies on this. + // Eventually we may change this if/when we update the loader to not require this field anymore + // Related, we also write to `hub` in {@link ./../sdk.ts registerClientOnGlobalHub} const sentry = getSentryCarrier(registry) as { hub?: AsyncContextStack }; - // If there's no hub, or its an old API, assign a new one if (sentry.hub) { return sentry.hub; } diff --git a/packages/core/src/sdk.ts b/packages/core/src/sdk.ts index 85fdeae6e4d6..70bf19779c9b 100644 --- a/packages/core/src/sdk.ts +++ b/packages/core/src/sdk.ts @@ -48,11 +48,11 @@ export function setCurrentClient(client: Client): void { } /** - * Unfortunately, we still have to manually bind the client to the "hub" set on the global + * Unfortunately, we still have to manually bind the client to the "hub" property set on the global * Sentry carrier object. This is because certain scripts (e.g. our loader script) obtain * the client via `window.__SENTRY__.hub.getClient()`. * - * @see {@link hub.ts getGlobalHub} + * @see {@link ./asyncContext/stackStrategy.ts getAsyncContextStack} */ function registerClientOnGlobalHub(client: Client): void { const sentryGlobal = getSentryCarrier(getMainCarrier()) as { hub?: AsyncContextStack };