Skip to content

Latest commit

 

History

History
83 lines (66 loc) · 2.61 KB

File metadata and controls

83 lines (66 loc) · 2.61 KB

Uploading Source Maps in a TanStack Start Project Using sentryTanstackStart

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:

SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___

and configure sentryTanstackStart in your vite.config.ts:

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,
    }),
  ],
});
Source map upload **only** works when `org`, `project`, and `authToken` are all configured. Without these options, source maps will not be uploaded to Sentry.

Source Map Options

The plugin, by default, automatically enables hidden source maps and deletes .map files after upload.

Configure source map behavior using the plugin options, for example:

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

export default defineConfig({
  plugins: [
    tanstackStart(),
    sentryTanstackStart({
      org: "___ORG_SLUG___",
      project: "___PROJECT_SLUG___",
      authToken: process.env.SENTRY_AUTH_TOKEN,

      sourcemaps: {
        assets: ["./dist/**/*"],
        ignore: ["**/node_modules/**"],
        filesToDeleteAfterUpload: [
          "./**/*.map",
          ".*/**/public/**/*.map",
          "./dist/**/client/**/*.map",
        ],
      },
    }),
  ],
});
Generating source maps **may expose them to the public**, potentially causing your source code to be leaked. The `sentryTanstackStart` plugin automatically deletes source map files after upload by default. If you customize this behavior, ensure your server denies access to `.js.map` files, or configure [`sourcemaps.filesToDeleteAfterUpload`](/platforms/javascript/sourcemaps/uploading/vite/) to delete source maps after upload.

Troubleshooting

If you're experiencing issues with source maps, see Troubleshooting Source Maps.