diff --git a/packages/core/src/trpc.ts b/packages/core/src/trpc.ts index d41030b22dd6..7e29a69903a1 100644 --- a/packages/core/src/trpc.ts +++ b/packages/core/src/trpc.ts @@ -1,4 +1,4 @@ -import { getClient, withScope } from './currentScopes'; +import { getClient, withIsolationScope } from './currentScopes'; import { captureException } from './exports'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes'; import { startSpanManual } from './tracing'; @@ -76,7 +76,7 @@ export function trpcMiddleware(options: SentryTrpcMiddlewareOptions = {}) { } } - return withScope(scope => { + return withIsolationScope(scope => { scope.setContext('trpc', trpcContext); return startSpanManual( { diff --git a/packages/core/test/lib/trpc.test.ts b/packages/core/test/lib/trpc.test.ts index 9a27e62c38ae..c3eca8cf4954 100644 --- a/packages/core/test/lib/trpc.test.ts +++ b/packages/core/test/lib/trpc.test.ts @@ -26,7 +26,7 @@ describe('trpcMiddleware', () => { setExtra: vi.fn(), }; - const withScope = vi.fn(callback => { + const withIsolationScope = vi.fn(callback => { return callback(mockScope); }); @@ -38,7 +38,7 @@ describe('trpcMiddleware', () => { client.init(); vi.spyOn(currentScopes, 'getClient').mockReturnValue(mockClient); vi.spyOn(tracing, 'startSpanManual').mockImplementation((name, callback) => callback(mockSpan, () => {})); - vi.spyOn(currentScopes, 'withScope').mockImplementation(withScope); + vi.spyOn(currentScopes, 'withIsolationScope').mockImplementation(withIsolationScope); vi.spyOn(exports, 'captureException').mockImplementation(() => 'mock-event-id'); });