From 06455b5537214dd11d718639c78a4ab88d3282d6 Mon Sep 17 00:00:00 2001 From: Abdelrahman Awad Date: Mon, 23 Mar 2026 16:12:24 -0400 Subject: [PATCH] fix(nextjs): Export `captureRouterTransitionStart` from server entry as noop Linters using `import/namespace` (eslint-plugin-import, oxlint) resolve `@sentry/nextjs` to the server entry point (`index.server.js`) rather than the `types` condition. Since `captureRouterTransitionStart` was only exported from the client entry, linters reported it as missing from the namespace. Add a server-side noop stub (matching the existing pattern for `showReportDialog`) and an explicit re-export in `index.types.ts` to resolve the `export *` ambiguity. Fixes #19939 Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/nextjs/src/index.types.ts | 2 ++ packages/nextjs/src/server/index.ts | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/packages/nextjs/src/index.types.ts b/packages/nextjs/src/index.types.ts index 7c92fecd7834..842e92fe8eaf 100644 --- a/packages/nextjs/src/index.types.ts +++ b/packages/nextjs/src/index.types.ts @@ -151,3 +151,5 @@ export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegra export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook; export declare const statsigIntegration: typeof clientSdk.statsigIntegration; export declare const unleashIntegration: typeof clientSdk.unleashIntegration; + +export declare const captureRouterTransitionStart: typeof clientSdk.captureRouterTransitionStart; diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index 0483ab6448ff..df6c1e7398c9 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -93,6 +93,13 @@ export function showReportDialog(): void { return; } +/** + * Noop on the server - this is a client-only API to capture Next.js router transitions. + */ +export function captureRouterTransitionStart(_href: string, _navigationType: string): void { + return; +} + /** * Returns the runtime configuration for the SDK based on the environment. * When running on OpenNext/Cloudflare, returns cloudflare runtime config.