From 163d0fad720d7979f25ddb926d74fb06e3d9cebb Mon Sep 17 00:00:00 2001 From: Francesco Gringl-Novy Date: Tue, 26 May 2026 14:21:44 +0200 Subject: [PATCH 1/2] ref(node): Stop using `registerSpanErrorInstrumentation()` on server --- packages/core/src/server-runtime-client.ts | 4 ---- packages/core/src/tracing/errors.ts | 4 ---- packages/node-core/src/integrations/onuncaughtexception.ts | 2 -- 3 files changed, 10 deletions(-) diff --git a/packages/core/src/server-runtime-client.ts b/packages/core/src/server-runtime-client.ts index d969f3580114..26ae3e80f3b1 100644 --- a/packages/core/src/server-runtime-client.ts +++ b/packages/core/src/server-runtime-client.ts @@ -3,7 +3,6 @@ import { Client } from './client'; import { getIsolationScope } from './currentScopes'; import { DEBUG_BUILD } from './debug-build'; import type { Scope } from './scope'; -import { registerSpanErrorInstrumentation } from './tracing'; import { DEFAULT_TRANSPORT_BUFFER_SIZE } from './transports/base'; import { addUserAgentToTransportHeaders } from './transports/userAgent'; import type { CheckIn, MonitorConfig, SerializedCheckIn } from './types/checkin'; @@ -38,9 +37,6 @@ export class ServerRuntimeClient< * @param options Configuration options for this SDK. */ public constructor(options: O) { - // Server clients always support tracing - registerSpanErrorInstrumentation(); - addUserAgentToTransportHeaders(options); super(options); diff --git a/packages/core/src/tracing/errors.ts b/packages/core/src/tracing/errors.ts index cf7aafbac8ea..bccc4225f61b 100644 --- a/packages/core/src/tracing/errors.ts +++ b/packages/core/src/tracing/errors.ts @@ -33,10 +33,6 @@ export function registerSpanErrorInstrumentation(): void { } } - // The function name will be lost when bundling but we need to be able to identify this listener later to maintain the - // node.js default exit behaviour - errorCallback.tag = 'sentry_tracingErrorCallback'; - errorsInstrumented = true; addGlobalErrorInstrumentationHandler(errorCallback); addGlobalUnhandledRejectionInstrumentationHandler(errorCallback); diff --git a/packages/node-core/src/integrations/onuncaughtexception.ts b/packages/node-core/src/integrations/onuncaughtexception.ts index 8afa70787a5c..5300b31df54c 100644 --- a/packages/node-core/src/integrations/onuncaughtexception.ts +++ b/packages/node-core/src/integrations/onuncaughtexception.ts @@ -89,8 +89,6 @@ export function makeErrorHandler(client: NodeClient, options: OnUncaughtExceptio return ( // as soon as we're using domains this listener is attached by node itself listener.name !== 'domainUncaughtExceptionClear' && - // the handler we register for tracing - listener.tag !== 'sentry_tracingErrorCallback' && // the handler we register in this integration (listener as ErrorHandler)._errorHandler !== true ); From 5ea5d93e35eae84d92c3cde57e2cd8eac75241bd Mon Sep 17 00:00:00 2001 From: Francesco Gringl-Novy Date: Wed, 27 May 2026 09:45:17 +0200 Subject: [PATCH 2/2] add node-integration-test --- .../suites/express/handle-error/test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dev-packages/node-integration-tests/suites/express/handle-error/test.ts b/dev-packages/node-integration-tests/suites/express/handle-error/test.ts index 4e702360242f..e66850393c78 100644 --- a/dev-packages/node-integration-tests/suites/express/handle-error/test.ts +++ b/dev-packages/node-integration-tests/suites/express/handle-error/test.ts @@ -10,6 +10,15 @@ test('should capture and send Express controller error with txn name if tracesSa .expect({ transaction: { transaction: 'GET /test/express/:id', + contexts: { + trace: { + op: 'http.server', + status: 'internal_error', + data: expect.objectContaining({ + 'http.response.status_code': 500, + }), + }, + }, }, }) .expect({