Skip to content

@sentry/nuxt: client sourcemaps/debug ID injection do not run on Vite 7 because sentryVitePlugin is added too late #19819

@ferdinandfrank

Description

@ferdinandfrank

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nuxt

SDK Version

10.42.0

Framework Version

Nuxt 4.3.1

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

  1. Create a Nuxt 4 app on Vite 7.
  2. Add @sentry/nuxt/module.
  3. Configure Sentry for a production build with:
    • org
    • project
    • authToken
    • release.name
    • browser sourcemaps enabled
  4. Run a production build.
  5. Trigger a client-side/browser error.
  6. Check the built client chunks and the resulting Sentry event.

Expected Result

For client builds, Sentry should:

  • run the Vite plugin during the browser build
  • inject SENTRY_RELEASE
  • inject debug IDs (sentry-dbid-*)
  • upload/link client sourcemaps correctly
  • show a non-null release on browser events
  • symbolicate browser stack traces

Actual Result

Server-side sourcemaps work, but client-side sourcemaps do not.

For browser errors:

  • events arrive without a linked release / release is effectively missing for the browser event path
  • stack traces remain minified
  • built client chunks do not contain SENTRY_RELEASE
  • built client chunks do not contain sentry-dbid-* markers

Additional Context

After debugging this in depth, the problem appears to be how @sentry/nuxt registers @sentry/vite-plugin for the client build.

The current Nuxt integration path adds sentryVitePlugin(...) from a Vite config() hook. On Vite 7, plugins pushed there are ignored because plugin resolution has already happened, so the plugin never actually participates in the client build.

That means the client-side Vite plugin hooks such as renderChunk() / writeBundle() do not run, which explains why:

  • no SENTRY_RELEASE banner is injected
  • no debug IDs are injected
  • no client sourcemaps are linked correctly
  • browser events remain unsymbolicated

This also explains why server-side sourcemaps still work: the server path is handled separately through Nitro/Rollup and is unaffected.

I was able to confirm the root cause with a workaround:

  • registering sentryVitePlugin(...) directly via Nuxt’s addVitePlugin(...) for dev: false and server: false immediately fixed the problem
  • after doing that, client bundles contained release/debug ID markers and new browser issues were symbolicated correctly

So this looks like a compatibility issue between @sentry/nuxt and Vite 7’s plugin lifecycle, specifically for the client build path.

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions