Skip to content

Next.js Build Time Nearly Doubles After Integrating @sentry/nextjs #15469

@dalnoki

Description

@dalnoki

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

Framework Version

Next.js Version: 14.1.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

After integrating @sentry/nextjs into the customer's Next.js project, they noticed a significant increase in build times. The build time consistently jumps from about 21–22 seconds to ~47–60 seconds, despite excluding Sentry Replays. Additionally, it appears the build process is running on a single processor core, leading to slower performance.

Build Time Comparison:
With Sentry:
Install: ~10s
Build: ~47-60s
Without Sentry:
Install: ~7s
Build: ~21-22s

Sentry SDK Configuration:
sentry.client.config.js | sentry.edge.config.js | sentry.server.config.js

all three files are same as below

import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,

// 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,
});

Calculated build time using following commands -
time npm install
time npm run build

Expected Result

Minimal or no impact on build time after integrating Sentry, or at least a smaller overhead compared to the observed near-doubling in build duration.

Actual Result

Build time increases by over 100% (from ~21–22 seconds to ~47–60 seconds).

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPackage: nextjsIssues related to the Sentry Nextjs SDK

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions