Source Maps
Minified JavaScript stacktraces are unreadable. Upload source maps so Tindra can show you the original file names and line numbers.
How it works
When Tindra receives a JavaScript error, it looks up the source map for the file and line in the event, then rewrites the stacktrace to show the original source. The source map is stored by release, so you need to upload a fresh set with each deploy.
Uploading source maps
Using the Sentry CLI
Install the Sentry CLI:
npm install --save-dev @sentry/cli
Build your project with source maps enabled, then upload:
npx sentry-cli --url https://your-hostname.tindra.sh \
releases files 1.4.2 upload-sourcemaps ./dist \
--auth-token your-auth-token \
--org your-org \
--project your-project
Get your auth token from Settings > Auth Tokens in the dashboard.
With Vite
npm install --save-dev @sentry/vite-plugin
// vite.config.js
import { sentryVitePlugin } from '@sentry/vite-plugin';
export default {
build: {
sourcemap: true,
},
plugins: [
sentryVitePlugin({
url: 'https://your-hostname.tindra.sh',
authToken: process.env.SENTRY_AUTH_TOKEN,
org: 'your-org',
project: 'your-project',
release: {
name: process.env.npm_package_version,
},
}),
],
};
With webpack
npm install --save-dev @sentry/webpack-plugin
// webpack.config.js
const { SentryWebpackPlugin } = require('@sentry/webpack-plugin');
module.exports = {
devtool: 'source-map',
plugins: [
new SentryWebpackPlugin({
url: 'https://your-hostname.tindra.sh',
authToken: process.env.SENTRY_AUTH_TOKEN,
org: 'your-org',
project: 'your-project',
release: process.env.npm_package_version,
include: './dist',
}),
],
};
Matching source maps to events
The release tag in your SDK init must match the release name you used when uploading source maps:
Sentry.init({
dsn: '...',
release: '1.4.2', // Must match the release used in sentry-cli upload
});
Serving source maps publicly
As an alternative to uploading, you can serve source maps from your own server and Tindra will fetch them on demand. The sourceMappingURL comment at the bottom of each JS file tells Tindra where to find the map.
This approach is simpler but means source maps are publicly accessible. If that is acceptable for your project, no upload step is needed.