-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
9.1.0
Framework Version
Next 14.2.4
Link to Sentry event
Reproduction Example/SDK Setup
sentry.client.config.ts
// This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import { Environment } from '@newdays/platform-layer/common/environment';
import { MonitoringConfig } from '@newdays/platform-layer/common/monitoring-config';
import * as Sentry from '@sentry/nextjs';
Sentry.init({
dsn: 'https://aedf18cc6cd72059ecd18e07156d03eb@o4507609249611776.ingest.us.sentry.io/4508092950183936',
// Add optional integrations for additional features
integrations: [Sentry.replayIntegration(), Sentry.browserTracingIntegration()],
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: 1,
// Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/app.*/],
// Define how likely Replay events are sampled.
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// Define how likely Replay events are sampled when an error occurs.
replaysOnErrorSampleRate: 1.0,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
// The environment for emitting metrics
environment: Environment.get(),
// Whether to enable monitoring
enabled: MonitoringConfig.isEnabled(),
});
sentry.edge.config.ts
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
// The config you add here will be used whenever one of the edge features is loaded.
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import { Environment } from '@newdays/platform-layer/common/environment';
import { MonitoringConfig } from '@newdays/platform-layer/common/monitoring-config';
import * as Sentry from '@sentry/nextjs';
Sentry.init({
dsn: 'https://aedf18cc6cd72059ecd18e07156d03eb@o4507609249611776.ingest.us.sentry.io/4508092950183936',
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: 1,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
// The environment for emitting metrics
environment: Environment.get(),
// Whether to enable monitoring
enabled: MonitoringConfig.isEnabled(),
});
sentry.server.config.ts
// This file configures the initialization of Sentry on the server.
// The config you add here will be used whenever the server handles a request.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import { Environment } from '@newdays/platform-layer/common/environment';
import { MonitoringConfig } from '@newdays/platform-layer/common/monitoring-config';
import * as Sentry from '@sentry/nextjs';
Sentry.init({
dsn: 'https://aedf18cc6cd72059ecd18e07156d03eb@o4507609249611776.ingest.us.sentry.io/4508092950183936',
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: 1,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
// The environment for emitting metrics
environment: Environment.get(),
// Whether to enable monitoring
enabled: MonitoringConfig.isEnabled(),
});
Steps to Reproduce
- Setup backend with NestJS and enable sentry on nestjs.
- Setup frontend with nextjs and enable sentry on nextjs. The frontend should be using nextjs rewrite to proxy the path to an external URL.
- Make a browser fetch request to the path.
- Examine fetch request headers in browser and ensure that the sentry headers match the meta tags embedded in the browser.
- Examine headers on backend.
Expected Result
Sentry trace propagation expectations
When a fetch request is made with proper sentry headers, the trace should continue on the nextjs server and on the backend. While the trace does continue on the nextjs server, the sentry headers get overwritten with some other trace before being sent to the external URL.
Actual Result
Fetch request in browser
Metadata
Metadata
Assignees
Projects
Status
Waiting for: Community
