---
title: "sentryTanstackStart"
description: "Learn about the sentryTanstackStart Vite plugin."
url: https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart/
---

# sentryTanstackStart for TanStack Start React

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.

## [Usage](https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.md#usage)

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:

```bash
SENTRY_AUTH_TOKEN=<your-sentry-auth-token>
```

Using environment variables in Vite configs

Vite doesn't automatically load `.env` files into `process.env` when evaluating the config file. If you store your auth token in a `.env` file and want to access it via `process.env.SENTRY_AUTH_TOKEN`, use Vite's [`loadEnv`](https://vite.dev/guide/api-javascript#loadenv) helper:

```javascript
import { defineConfig, loadEnv } from "vite";

export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd(), "");

  return {
    plugins: [
      sentryVitePlugin({
        authToken: env.SENTRY_AUTH_TOKEN,
        // ...
      }),
    ],
  };
});
```

Alternatively, use a `.env.sentry-build-plugin` file, which the Sentry plugin reads automatically.

Configure `sentryTanstackStart` in your vite.config.ts:

```typescript
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: "<your-org-slug>",
      project: "<your-project-slug>",
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
});
```

Source map upload **only** works when `org`, `project`, and `authToken` are all configured. Without these options, source maps will not be uploaded to Sentry.

## [Configuration Options](https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.md#configuration-options)

The plugin passes through all options to the underlying [`@sentry/bundler-plugins/vite`](https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/vite.md). See the [Sentry Vite Plugin documentation](https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/bundler-plugin-options.md) for the full list of available options.

### [Automatic Middleware Instrumentation](https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.md#automatic-middleware-instrumentation)

Available since: `v10.37.0`

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

```typescript
sentryTanstackStart({
  // ...
  autoInstrumentMiddleware: false,
}),
```

### [Component Name Annotation](https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.md#component-name-annotation)

Available since: `v10.55.0`

The `reactComponentAnnotation` option annotates your React components with `data-sentry-component` and `data-sentry-source-file` attributes at build time. This lets you see component names instead of generic selectors in Session Replay, breadcrumbs, and performance monitoring.

```typescript
sentryTanstackStart({
  // ...
  reactComponentAnnotation: {
    enabled: true,
  },
}),
```

To exclude specific components from annotation:

```typescript
sentryTanstackStart({
  // ...
  reactComponentAnnotation: {
    enabled: true,
    ignoredComponents: ["MyInternalComponent"],
  },
}),
```

### [Tunnel Route](https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.md#tunnel-route)

Available since: `v10.51.0`

This option is deprecated and will be removed in v12. Set `tunnel: true` in the browser and add `serveTunnelIntegration` on the server instead, as described in [Tunneling](https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/configuration/tunneling.md).

The `tunnelRoute` option serves a tunnel on your own origin that forwards browser events to Sentry, so ad blockers don't drop them. It also sets the browser `tunnel` option for you.
