Open
@m-nathani

Description

Route Navigation Errors with sendDefaultPii Configuration

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

9.28.0

Framework Version

React 19 and Next 15.3.3

Link to Sentry event

No response

Reproduction Example/SDK Setup

Environment

  • Package: @sentry/nextjs ( 9.28.0)
  • Framework: Next.js 15
  • Configuration Files: sentry.edge.config.ts and/or sentry.server.config.ts

Issue Description

After updating to the latest version of @sentry/nextjs and adding the sendDefaultPii: true configuration option, navigation between routes triggers invalid parameter-related errors that prevent proper route transitions.

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 { env } from '@/env';
import * as Sentry from '@sentry/nextjs';

Sentry.init({
  dsn: env.NEXT_PUBLIC_SENTRY_DSN,
  environment: env.NEXT_PUBLIC_APP_ENV,

  // Adds request headers and IP for users, for more info visit:
  // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
  sendDefaultPii: true,

  // Define how likely traces are sampled.
  tracesSampleRate: env.NEXT_PUBLIC_APP_ENV === 'production' ? 0.1 : 0.6,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: false,
});

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 { env } from '@/env';
import * as Sentry from '@sentry/nextjs';

Sentry.init({
  dsn: env.NEXT_PUBLIC_SENTRY_DSN,
  environment: env.NEXT_PUBLIC_APP_ENV,

    // Adds request headers and IP for users, for more info visit:
  // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
  sendDefaultPii: true,

  // Define how likely traces are sampled.
  tracesSampleRate: env.NEXT_PUBLIC_APP_ENV === 'production' ? 0.1 : 0.6,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: false,
});

Steps to Reproduce

Steps to Reproduce

  1. Update @sentry/nextjs to the latest version
  2. Add the following configuration to sentry.edge.config.ts or sentry.server.config.ts:
    // Adds request headers and IP for users, for more info visit:
    // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
    sendDefaultPii: true,
  3. Navigate between routes in the Next.js application
  4. Observe route navigation errors related to invalid parameters

Workaround

The issue is resolved by either:

  • Downgrading @sentry/nextjs to a previous version, OR
  • Removing the sendDefaultPii: true configuration

Additional Context

  • The errors specifically mention issues with route parameters
  • The parameter errors appear to be false positives as they disappear when the Sentry configuration is modified
  • This suggests the sendDefaultPii option may be interfering with Next.js's internal route parameter handling or validation

Expected Result

Expected Behavior

Route navigation should work normally without throwing parameter-related errors when sendDefaultPii is enabled.

Impact

This prevents users from enabling PII collection for better debugging context while maintaining stable route navigation in their Next.js applications.

Actual Result

Actual Behavior

Navigation between routes fails with parameter validation errors that appear to be invalid/spurious.

> next dev -p 3012

   ▲ Next.js 15.3.3
   - Local:        http://localhost:3012
   - Network:      http://192.168.0.160:3012
   - Environments: .env
   - Experiments (use with caution):
     · clientTraceMetadata

 ✓ Starting...
 ○ Compiling /instrumentation ...
 ✓ Compiled /instrumentation in 9.5s (938 modules)
 ✓ Ready in 16.2s
 ○ Compiling /middleware ...
 ✓ Compiled /middleware in 1673ms (624 modules)
 ○ Compiling /[locale]/partner/[slug] ...
 ✓ Compiled /[locale]/partner/[slug] in 13s (3514 modules)
 GET /en/partner/kwc-singapore 200 in 18157ms
Error: Route "/[locale]/partner/[slug]" used `...params` or similar expression. `params` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
Error: Route "/[locale]/partner/[slug]" used `params.locale`. `params` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
Error: Route "/[locale]/partner/[slug]" used `params.slug`. `params` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
Error: Route "/[locale]/partner/[slug]" used `searchParams.__isVue`. `searchParams` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
Error: Route "/[locale]/partner/[slug]" used `searchParams._isVue`. `searchParams` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
Error: Route "/[locale]/partner/[slug]" used `searchParams.__sentry_skip_normalization__`. `searchParams` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
Error: Route "/[locale]/partner/[slug]" used `searchParams.__sentry_override_normalization_depth__`. `searchParams` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
Error: Route "/[locale]/partner/[slug]" used `Object.keys(searchParams)` or similar. `searchParams` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)