Source Maps
Upload your source maps to Sentry to enable readable stack traces in your errors.
Currently the Sentry TanStack Start SDK does not upload source maps automatically. This will change in the future.
For now, please use the Sentry Vite Plugin (recommended) or Sentry CLI (more flexible) to upload sourcemaps.
Note: Source maps are only generated and uploaded during production builds (npm run build
). Development builds (npm run dev
) do not generate source maps for upload.
See how uploading source maps lets you see the exact line of code that caused an error:
Install the Sentry Vite plugin as a development dependency:
npm install @sentry/vite-plugin --save-dev
To automatically upload source maps, you need to provide your Sentry auth token, organization, and project slugs in your Vite configuration:
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
SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE
Configure source map behavior using the Vite plugin options:
vite.config.ts
import { defineConfig } from "vite";
import { sentryVitePlugin } from "@sentry/vite-plugin";
export default defineConfig({
plugins: [
sentryVitePlugin({
org: "example-org",
project: "example-project",
authToken: process.env.SENTRY_AUTH_TOKEN,
sourcemaps: {
assets: ["./dist/**/*"],
ignore: ["**/node_modules/**"],
filesToDeleteAfterUpload: ["./dist/**/*.map"],
},
}),
],
build: {
sourcemap: true,
},
});
If you prefer more control over the upload process, you can use the Sentry CLI instead:
npm install @sentry/cli --save-dev
Then add a script to your package.json
:
package.json
{
"scripts": {
"build": "vite build",
"upload-sourcemaps": "sentry-cli sourcemaps upload --org example-org --project example-project ./dist"
}
}
If you're experiencing issues with source maps, see Troubleshooting Source Maps.
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").