Skip to content

Commit 1381a75

Browse files
committed
fix(nextjs): Add api/ to BrowserTracing tracingOrigins
Update default tracingOrigins for NextJS BrowserTracing to include api routes so we can add sentry-trace header correctly.
1 parent 11a7a26 commit 1381a75

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/nextjs/src/index.client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { configureScope, init as reactInit } from '@sentry/react';
2-
import { Integrations } from '@sentry/tracing';
2+
import { defaultRequestInstrumentationOptions, Integrations } from '@sentry/tracing';
33

44
import { nextRouterInstrumentation } from './performance/client';
55
import { MetadataBuilder } from './utils/metadataBuilder';
@@ -33,6 +33,7 @@ export function init(options: NextjsOptions): void {
3333
}
3434

3535
const defaultBrowserTracingIntegration = new BrowserTracing({
36+
tracingOrigins: [...defaultRequestInstrumentationOptions.tracingOrigins, /^(api\/)/],
3637
routingInstrumentation: nextRouterInstrumentation,
3738
});
3839

0 commit comments

Comments
 (0)