Skip to content

[RR7] url in unstable_sentryVitePluginOptions is ignored in React Router Vite plugin #15965

Closed
@simply-arjen

Description

@simply-arjen

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/react-router

SDK Version

9.10.1

Framework Version

react-router@7.4.0 + vite@6.2.4 + @sentry/react-router@9.10.1"

Link to Sentry event

No response

Reproduction Example/SDK Setup

We have a self hosted Sentry setup and last week we migrated from @sentry/remix to @sentry/react-router. Before we could set the url in the Vite Sentry plugin options to point to our self hosted Sentry instance. With the new React Router plugin this value seems to be ignored.

The only way to upload the source maps to our Sentry instance is by setting the env var SENTRY_URL.

Setting the url in the plugin configuration does not seem to do anything, Sentry uses the default value:

const sentryConfig: SentryReactRouterBuildOptions = {
  org: 'sentry',
  project: env.VITE_SENTRY_PROJECT,
  authToken: env.VITE_SENTRY_AUTH_TOKEN,
  telemetry: false,
  sourceMapsUploadOptions: {
    release: { name: env.VITE_RELEASE_SHA },
  },
  release: {
    name: env.VITE_RELEASE_SHA,
  },
  unstable_sentryVitePluginOptions: {
    // This value is somehow ignored by Sentry, instead it's using the SENTRY_URL env var if set, 
    // or uses sentry.io otherwise.
    url: env.VITE_SENTRY_URL,
    applicationKey: 'store',
    disable: disableSentry(),
    release: {
      uploadLegacySourcemaps: { paths: ['build'], ext: ['js', 'map', 'mjs'] },
      name: env.VITE_RELEASE_SHA,
      dist: env.VITE_RELEASE_SHA,
    },
  },
};

Steps to Reproduce

Set a value for unstable_sentryVitePluginOptions.url

Expected Result

Sourcemaps are uploaded to the sentry instance defined in unstable_sentryVitePluginOptions.url.

Actual Result

Uploading sourcempas fails with an authentication error. (This is because the plugin tries to upload theme to Sentry instead of our self hosted instance).

Obviously it's unstable for a reason, and we can work around it by setting the SENTRY_URL env var. but I'd figured I mention it for anyone else running into this.

Metadata

Metadata

Assignees

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions