This guide walks you through setting up Sentry error tracking for LENR Academy with automatic source map uploads.
Sentry is configured to:
- ✅ Track errors in production only
- ✅ Upload source maps automatically on deployment
- ✅ Respect user privacy (no PII, URL scrubbing, EU hosting)
- ✅ Delete source maps from bundle after upload
- ✅ Track release versions via git tags
- Sentry account (free tier: 5,000 errors/month)
- GitHub repository admin access (to add secrets)
-
Sign up at Sentry:
- Visit: https://sentry.io/signup/
- Important: Select EU region during signup for GDPR compliance
-
Create a new project:
- Click "Create Project"
- Platform: React
- Alert frequency: Choose your preference (default is fine)
- Project name:
lenr-academy(or your preference) - Click "Create Project"
-
Save your project details:
- Organization slug: Found in URL
https://sentry.io/organizations/YOUR-ORG/ - Project slug: Found in project settings or URL
- DSN: Provided after project creation (looks like
https://xxxxx@o000000.ingest.sentry.io/0000000)
- Organization slug: Found in URL
- Go to: https://sentry.io/settings/account/api/auth-tokens/
- Click "Create New Token"
- Name:
lenr-academy-ci - Scopes (check these):
- ✅ Project: Read & Write
- ✅ Release: Admin
- Click "Create Token"
- Copy the token (you won't see it again!)
Go to your GitHub repository:
https://github.com/Episk-pos/lenr.academy/settings/secrets/actions
Add the following Repository Secrets:
| Secret Name | Value | Where to Find |
|---|---|---|
VITE_SENTRY_DSN |
Your Sentry DSN | Sentry Project Settings → Client Keys |
SENTRY_ORG |
Your organization slug | Sentry URL (e.g., lenr-academy-org) |
SENTRY_PROJECT |
Your project slug | Sentry project settings (e.g., lenr-academy) |
SENTRY_AUTH_TOKEN |
Auth token from Step 2 | Token you just created |
Example:
VITE_SENTRY_DSN=https://abc123@o123456.ingest.sentry.io/7890123
SENTRY_ORG=lenr-academy-org
SENTRY_PROJECT=lenr-academy
SENTRY_AUTH_TOKEN=sntrys_abc123def456... (long token)
-
Deploy a new release:
npm run release:alpha # Then uncheck "prerelease" on GitHub to trigger deployment -
Check build logs:
- Go to GitHub Actions → Deploy to Production
- Look for Sentry source map upload messages in build step
- Should see:
Source maps uploaded to Sentry
-
Verify in Sentry:
- Go to: https://sentry.io/organizations/YOUR-ORG/projects/lenr-academy/
- Navigate to: Releases
- Your latest version should appear with source maps
-
Trigger a test error:
- Visit: https://lenr.academy
- Open browser console
- Run:
throw new Error("Test Sentry integration")
-
Check Sentry dashboard:
- Go to: https://sentry.io/organizations/YOUR-ORG/issues/
- Your error should appear within seconds
- Click on it to see full stack trace with file names and line numbers
To test Sentry locally:
-
Create
.env.local(gitignored):VITE_SENTRY_DSN=your-dsn-here
-
Build and test:
npm run build npm run serve
-
Trigger test error in browser console:
throw new Error("Local test error")
-
Note: In development mode (
npm run dev), Sentry only logs to console and doesn't send events.
✅ Sent:
- Error messages and stack traces
- Browser type and version
- Page URL (scrubbed - only safe params kept)
- Release version (git tag)
- User actions before error (breadcrumbs)
❌ NOT sent:
- User IP addresses (
sendDefaultPii: false) - Sensitive URL parameters (only
ZandAkept) - Session replays (disabled except 10% of errors)
- Any personally identifiable information
- ✅ Uploaded to Sentry for readable stack traces
- ✅ Deleted from production bundle (not publicly accessible)
- ✅ Only accessible to your Sentry team
- ✅ Automatically cleaned up after upload
Access your errors at:
https://sentry.io/organizations/YOUR-ORG/issues/
Features:
- View all errors with frequency charts
- See which release versions have errors
- Filter by browser, OS, URL
- Set up email/Slack alerts
-
Critical Errors:
- Navigate to: Alerts → Create Alert
- Condition: "An event is seen"
- Filters: "Level equals Error"
- Action: Email notification
-
High-Volume Issues:
- Condition: "Issue is seen more than 100 times in 1 hour"
- Action: Slack notification (optional)
Issue: Build fails with "Unable to upload source maps"
Solutions:
- Check that
SENTRY_AUTH_TOKENis set in GitHub secrets - Verify token has correct scopes (Project: Read & Write, Release: Admin)
- Confirm organization and project slugs are correct
Checklist:
-
VITE_SENTRY_DSNis set in GitHub secrets - Deployed version includes Sentry configuration
- Error occurred in production (not development)
- Check browser console for Sentry initialization logs
Solutions:
- Check that source maps were uploaded:
# In GitHub Actions logs, look for: # "Source maps uploaded to Sentry"
- Verify release name matches in Sentry dashboard
- Ensure build completed successfully
- Confirm debug IDs are embedded in JavaScript files (check verification step output in GitHub Actions)
The Vite plugin configuration has been optimized for reliable uploads:
- Debug mode: Enabled for verbose logging during builds
- Asset targeting: Configured to explicitly target
./dist/assets/**/*.js - URL prefix: Set to
~/assetsto match production serving path - Debug ID approach: Uses modern debug ID injection instead of filename matching
Important: Source map files (.map) are automatically deleted from dist/ after upload to Sentry. This is correct and expected behavior:
- Maps are stored securely on Sentry's servers
- JavaScript files contain embedded debug IDs for matching
.mapfiles should NOT appear in S3 or production deployments- This prevents your source code from being publicly accessible
If you see .map files in your production deployment, something is wrong with the build process.
- Sentry React Docs: https://docs.sentry.io/platforms/javascript/guides/react/
- Sentry Vite Plugin: https://github.com/getsentry/sentry-vite-plugin
- Privacy Features: https://docs.sentry.io/platforms/javascript/data-management/
- GDPR Compliance: https://sentry.io/trust/privacy/
npm update @sentry/react @sentry/vite-plugin- Create new token in Sentry (Step 2)
- Update
SENTRY_AUTH_TOKENin GitHub secrets - Delete old token in Sentry
Update these GitHub secrets:
SENTRY_ORGSENTRY_PROJECTVITE_SENTRY_DSN
Questions? Check the Sentry documentation or file an issue in the GitHub repository.