diff --git a/packages/nextjs/src/server/httpIntegration.ts b/packages/nextjs/src/server/httpIntegration.ts index a170e86bd4ea..1da29b5e866b 100644 --- a/packages/nextjs/src/server/httpIntegration.ts +++ b/packages/nextjs/src/server/httpIntegration.ts @@ -1,13 +1,5 @@ -import { Integrations } from '@sentry/node-experimental'; +import { httpIntegration as originalHttpIntegration } from '@sentry/node-experimental'; -/** - * A custom HTTP integration where we always enable tracing. - */ -export class Http extends Integrations.Http { - public constructor(options?: ConstructorParameters[0]) { - super({ - ...options, - tracing: true, - }); - } -} +export const httpIntegration: typeof originalHttpIntegration = options => { + return originalHttpIntegration({ ...options, tracing: true }); +}; diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index 6ec2f500a8c3..a52a88a5db94 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -13,16 +13,14 @@ import { devErrorSymbolicationEventProcessor } from '../common/devErrorSymbolica import { getVercelEnv } from '../common/getVercelEnv'; import { isBuild } from '../common/utils/isBuild'; import { distDirRewriteFramesIntegration } from './distDirRewriteFramesIntegration'; -import { Http } from './httpIntegration'; -import { OnUncaughtException } from './onUncaughtExceptionIntegration'; +import { httpIntegration } from './httpIntegration'; +import { onUncaughtExceptionIntegration } from './onUncaughtExceptionIntegration'; export * from '@sentry/node-experimental'; export { captureUnderscoreErrorException } from '../common/_error'; export const Integrations = { ...OriginalIntegrations, - Http, - OnUncaughtException, }; const globalWithInjectedValues = global as typeof global & { @@ -85,8 +83,8 @@ export function init(options: NodeOptions): void { ...getDefaultIntegrations(options).filter( integration => !['Http', 'OnUncaughtException'].includes(integration.name), ), - new Http(), - new OnUncaughtException(), + httpIntegration(), + onUncaughtExceptionIntegration(), ]; // This value is injected at build time, based on the output directory specified in the build config. Though a default diff --git a/packages/nextjs/src/server/onUncaughtExceptionIntegration.ts b/packages/nextjs/src/server/onUncaughtExceptionIntegration.ts index e88520cf9534..8bbe348cb082 100644 --- a/packages/nextjs/src/server/onUncaughtExceptionIntegration.ts +++ b/packages/nextjs/src/server/onUncaughtExceptionIntegration.ts @@ -1,13 +1,5 @@ -import { Integrations } from '@sentry/node-experimental'; +import { onUncaughtExceptionIntegration as originalOnUncaughtExceptionIntegration } from '@sentry/node-experimental'; -/** - * A custom OnUncaughtException integration that does not exit by default. - */ -export class OnUncaughtException extends Integrations.OnUncaughtException { - public constructor(options?: ConstructorParameters[0]) { - super({ - exitEvenIfOtherHandlersAreRegistered: false, - ...options, - }); - } -} +export const onUncaughtExceptionIntegration: typeof originalOnUncaughtExceptionIntegration = options => { + return originalOnUncaughtExceptionIntegration({ ...options, exitEvenIfOtherHandlersAreRegistered: false }); +}; diff --git a/packages/nextjs/test/serverSdk.test.ts b/packages/nextjs/test/serverSdk.test.ts index a9ce73588e7a..24a03f39a95b 100644 --- a/packages/nextjs/test/serverSdk.test.ts +++ b/packages/nextjs/test/serverSdk.test.ts @@ -151,18 +151,6 @@ describe('Server init()', () => { expect(httpIntegration).toBeDefined(); expect(httpIntegration).toEqual(expect.objectContaining({ _tracing: {} })); }); - - it('forces `_tracing = true` even if set to false', () => { - init({ - integrations: [new Integrations.Http({ tracing: false })], - }); - - const nodeInitOptions = nodeInit.mock.calls[0][0] as ModifiedInitOptions; - const httpIntegration = findIntegrationByName(nodeInitOptions.integrations, 'Http'); - - expect(httpIntegration).toBeDefined(); - expect(httpIntegration).toEqual(expect.objectContaining({ _tracing: {} })); - }); }); }); });