sentryTanstackStart

Learn about the sentryTanstackStart Vite plugin.

Available since: v10.35.0

The sentryTanstackStart Vite plugin simplifies source map configuration for TanStack Start applications. It automatically handles source map generation and upload to Sentry during production builds.

To automatically upload source maps, you need to provide your Sentry auth token, organization, and project slugs in your Vite configuration. The plugin then, by default, automatically enables hidden source maps and deletes .map files after upload.

Make sure you add your auth token to your CI, if you are using one to deploy your application.

Add your auth token to your environment:

.env
Copied
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___

and configure sentryTanstackStart in your vite.config.ts:

vite.config.ts
Copied
import { defineConfig } from "vite";
import { sentryTanstackStart } from "@sentry/tanstackstart-react/vite";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";

export default defineConfig({
  plugins: [
    tanstackStart(),
    // other plugins - sentryTanstackStart should be last
    sentryTanstackStart({
      org: "___ORG_SLUG___",
      project: "___PROJECT_SLUG___",
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
});

The plugin passes through all options to the underlying @sentry/vite-plugin. See the Sentry Vite Plugin documentation for the full list of available options.

Additionally, the plugin automatically instruments all TanStack Start middlewares for tracing by default. To disable this behavior:

vite.config.ts
Copied
sentryTanstackStart({
  // ...
  autoInstrumentMiddleware: false,
}),
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").