nextjs - 💡(How to fix) Fix Sentry Spotlight sourcemaps work with Webpack but fail under Turbopack in Next.js (Next.js 16 + @sentry/nextjs) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#92857Fetched 2026-04-17 08:21:43
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
issue_type_added ×1labeled ×1

Error Message

This error is raised on the frontend of the example page. This error is raised on the frontend of the example page.

Code Example

next dev

---

import { withSentryConfig } from "@sentry/nextjs";
import type { NextConfig } from "next";
import bundleAnalyzer from "@next/bundle-analyzer";

const baseConfig: NextConfig = {
  reactStrictMode: false,

  async headers() {
    return [secHeaders];
  },

  experimental: {
    turbopackSourceMaps: true,
    turbopackInputSourceMaps: true,
  },
};

let nextConfig = baseConfig;

if (process.env.NEXT_PUBLIC_SENTRY_DISABLED !== "true") {
  nextConfig = withSentryConfig(nextConfig, {
    org: process.env.SENTRY_ORGANIZATION,
    project: process.env.SENTRY_PROJECT,
    authToken: process.env.SENTRY_AUTH_TOKEN,

    silent: !process.env.CI,
    widenClientFileUpload: true,

    // tunnelRoute intentionally disabled
    // tunnelRoute: "/monitoring",

    webpack: {
      reactComponentAnnotation: {
        enabled: true,
      },
      treeshake: {
        removeDebugLogging: true,
      },
    },

    telemetry: false,

    sourcemaps: {
      disable: false,
    },
  });
}

export default nextConfig;

---

webpack(config, { dev, isServer }) {
  if (dev && !isServer) {
    config.devtool = "source-map";
  }
  return config;
},

---

## 🧩 Environment

- Next.js: 15.x
- @sentry/nextjs: latest
- Node.js: 24+
- Bundlers:
  - Webpack (`next dev --webpack`)
  - Turbopack (`next dev`)
- Repro: local development
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/amscu-dev/AWS-Elastic-Beanstalk-NextJS-CI-CD

To Reproduce

🔁 To Reproduce

  1. Start the application in development mode:
    next dev

### Current vs. Expected behavior

# 🐛 Sentry Spotlight sourcemaps fail under Turbopack in Next.js (Webpack works correctly)

---

## 📄 Description

When using `@sentry/nextjs` with Next.js 16, source maps and Spotlight integration work correctly in Webpack dev mode, but fail under Turbopack.

Even though Turbopack source maps are enabled via experimental flags, Sentry Spotlight does not resolve stack traces to original source files. Instead, it shows minified or chunked output.

---

## ⚙️ Next.js Configuration

### `next.config.ts`

```ts
import { withSentryConfig } from "@sentry/nextjs";
import type { NextConfig } from "next";
import bundleAnalyzer from "@next/bundle-analyzer";

const baseConfig: NextConfig = {
  reactStrictMode: false,

  async headers() {
    return [secHeaders];
  },

  experimental: {
    turbopackSourceMaps: true,
    turbopackInputSourceMaps: true,
  },
};

let nextConfig = baseConfig;

if (process.env.NEXT_PUBLIC_SENTRY_DISABLED !== "true") {
  nextConfig = withSentryConfig(nextConfig, {
    org: process.env.SENTRY_ORGANIZATION,
    project: process.env.SENTRY_PROJECT,
    authToken: process.env.SENTRY_AUTH_TOKEN,

    silent: !process.env.CI,
    widenClientFileUpload: true,

    // tunnelRoute intentionally disabled
    // tunnelRoute: "/monitoring",

    webpack: {
      reactComponentAnnotation: {
        enabled: true,
      },
      treeshake: {
        removeDebugLogging: true,
      },
    },

    telemetry: false,

    sourcemaps: {
      disable: false,
    },
  });
}

export default nextConfig;

🧪 Working Webpack Dev Configuration

When using Webpack, enabling devtool makes Sentry Spotlight work correctly:

webpack(config, { dev, isServer }) {
  if (dev && !isServer) {
    config.devtool = "source-map";
  }
  return config;
},

❌ Broken Behavior (Turbopack)

Example stack trace:

SentryExampleFrontendError
This error is raised on the frontend of the example page.
_next/static/chunks/0mo1j7r..js in onClick at line 150:35

  • No original file mapping
  • Only chunked/minified output shown
  • Debugging experience degraded

✅ Expected Behavior

Sentry Spotlight should resolve stack traces to original source files in both modes.


🧪 Webpack result (correct):

SentryExampleFrontendError
This error is raised on the frontend of the example page.
src/app/page.tsx (150:35)

Provide environment information

## 🧩 Environment

- Next.js: 15.x
- @sentry/nextjs: latest
- Node.js: 24+
- Bundlers:
  - Webpack (`next dev --webpack`)
  - Turbopack (`next dev`)
- Repro: local development

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

extent analysis

TL;DR

Enable source maps for Turbopack by configuring the next.config.ts file to include source map settings.

Guidance

  • Verify that Turbopack source maps are correctly enabled via the experimental flags in next.config.ts.
  • Check the Sentry documentation for any specific requirements for source map configuration with Turbopack.
  • Compare the working Webpack dev configuration with the Turbopack configuration to identify any differences in source map settings.
  • Test the application with the updated configuration to ensure that Sentry Spotlight resolves stack traces to original source files.

Example

No code example is provided as the issue is related to configuration and not a specific code snippet.

Notes

The issue seems to be related to the configuration of source maps for Turbopack in Next.js. The working Webpack dev configuration provides a clue on how to configure source maps correctly.

Recommendation

Apply workaround by updating the next.config.ts file to include source map settings for Turbopack, as the issue is likely related to the configuration of source maps.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING