This guide explains how to configure Sentry error tracking for the Rootstock DAO Frontend.
- A Sentry account
- Access to create projects in your Sentry organization
- Log in to sentry.io
- Select your organization (or create one)
- Go to Projects → Create Project
- Choose Next.js as the platform
- Name the project (e.g.
dao-frontend) - Click Create Project
The DSN (Data Source Name) is the URL Sentry uses to receive error events.
- In the Sentry dashboard, go to Settings → Projects → select your project
- In the left sidebar, click Client Keys (DSN)
- Copy the DSN value. It looks like:
(Host may be
https://<key>@<org-id>.ingest.de.sentry.io/<project-id>.ingest.us.sentry.ioor.ingest.de.sentry.iodepending on project region.)
Alternatively:
- Go to Settings → Projects → your project
- Click Client Keys (DSN) under the Security & Privacy section
- Copy the DSN from the displayed configuration
Add these to your .env.* file (e.g. .env.testnet.local):
# Features
NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_ERROR_TRACKING=true
NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_REPLAY=false
# Sentry
NEXT_PUBLIC_SENTRY_DSN=https://<your-key>@<org-id>.ingest.de.sentry.io/<project-id>
SENTRY_ORG=rootstocklabs-limited
SENTRY_PROJECT=dao-frontend| Variable | Where to get it |
|---|---|
NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_ERROR_TRACKING |
Feature flag for error tracking. Set to true to enable |
NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_REPLAY |
Feature flag for session replay. Set to true only if you want replay (default: false) |
NEXT_PUBLIC_SENTRY_DSN |
Client Keys (DSN) in project settings |
SENTRY_ORG |
Organization slug from URL: sentry.io/organizations/<org-slug>/ |
SENTRY_PROJECT |
Project name from project settings |
The auth token is used during build to upload source maps for readable stack traces. Optional: without it, Sentry still captures errors but stack traces remain minified and unreadable.
- In Sentry, go to Settings → Auth Tokens
- Direct link:
https://sentry.io/settings/<org-slug>/auth-tokens/
- Direct link:
- Click Create New Token
- Configure:
- Name: e.g.
DAO Frontend Build - Scopes: Select at least:
project:readproject:releasesorg:read
- Expiration: Choose a duration or "No expiration"
- Name: e.g.
- Click Create Token
- Copy the token immediately — it is shown only once
Security: Never commit the auth token to the repository. Use:
.env.sentry-build-plugin(gitignored) for local builds, or- CI/CD secrets (e.g. GitHub Actions) for production builds
For local development builds with source map upload:
- Create
.env.sentry-build-pluginin the project root (if not using CI):SENTRY_AUTH_TOKEN=your_token_here SENTRY_ORG=rootstocklabs-limited SENTRY_PROJECT=dao-frontend
- Ensure this file is in
.gitignore - Run
npm run build— source maps will be uploaded to Sentry
For GitHub Actions or other CI:
- Add
SENTRY_AUTH_TOKENas a repository secret - Pass it to the build as a build-arg or environment variable
- Ensure
SENTRY_ORGandSENTRY_PROJECTare available during build
Example (GitHub Actions):
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: rootstocklabs-limited
SENTRY_PROJECT: dao-frontend- Set
NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_REPLAY=trueto enable - Requires
NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_ERROR_TRACKING=true - When enabled: 10% of sessions sampled; 100% of sessions with errors recorded
- Set
NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_ERROR_TRACKING=true - Run the app and trigger a test error (e.g. visit
/test-sentryif available) - Check the Sentry dashboard for the new event
- Optionally set
NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_REPLAY=trueto verify replay
| Issue | Solution |
|---|---|
| No events in Sentry | Verify NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_ERROR_TRACKING=true and DSN is set |
| No session replays | Set NEXT_PUBLIC_ENABLE_FEATURE_SENTRY_REPLAY=true (error tracking must be enabled first) |
| Source maps not uploading | Ensure SENTRY_AUTH_TOKEN is set during build with correct scopes |
| CORS/network errors not captured | These require explicit capture; see instrumentation and axios interceptors |
| Feature flag not working | Check the feature flag is in the correct .env.* for your PROFILE |