Skip to content

DYNAMIC_SERVER_USAGE in Next.js App Dir #9290

@EnriqCG

Description

@EnriqCG

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

7.74.0

Framework Version

Next.js 13.5.3

Link to Sentry event

https://the-network-state-co-5d0b7f51d.sentry.io/issues/4554179142/?project=4505835380736000&query=is:unresolved&statsPeriod=14d&stream_index=0

SDK Setup

  enableTracing: true,
  tracesSampleRate: 1,
  debug: false,
  replaysOnErrorSampleRate: 1.0,
  replaysSessionSampleRate: 0.1,
  environment: process.env.XX

Steps to Reproduce

  1. Set up Sentry for Next.js with the Wizard. Use the server configuration.
  2. Insert cookies() or headers() to make a Server Component render dynamically
  3. Build the application. No fatal errors that would prevent the build from finishing.

Expected Result

It should not send DYNAMIC_SERVER_USAGE traces that don't prevent the build from succeeding to Sentry.

I think this is a very similar issue to #7641 where Exceptions in Next.js are handled internally to create some kind of fallback behavior. In the case of DYNAMIC_SERVER_USAGE, it signals that the Server Component can't be pre-rendered at build time.

Actual Result

Once the build completes, see the Sentry Issue dashboard with "Dynamic server usage: Page couldn't be rendered statically because it used cookies"

image

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions