sentry-surface
v1.0.1
Published
Surface Sentry production errors in your terminal — no dashboard needed
Downloads
23
Maintainers
Readme
sentry-surface
Surface Sentry production errors in your terminal, no dashboard needed.
See real-time production errors right inside your build output or as a standalone watcher alongside your dev server.
Install
npm install sentry-surfaceSetup
Create a .sentrynotifyrc file in your project root:
{
"token": "your-sentry-auth-token",
"org": "your-org-slug",
"project": "your-project-slug"
}Or use environment variables:
export SENTRY_AUTH_TOKEN="your-token"
export SENTRY_ORG="your-org"
export SENTRY_PROJECT="your-project"Your auth token needs project:read and event:read scopes. Create one at Sentry > Settings > Auth Tokens.
Usage
Standalone CLI
Run alongside your dev server to see errors in real time:
npx sentry-watchVite plugin
// vite.config.ts
import { sentryVitePlugin } from "sentry-surface/vite";
export default {
plugins: [sentryVitePlugin()],
};Webpack plugin
// webpack.config.js
const { SentryWebpackPlugin } = require("sentry-surface/webpack");
module.exports = {
plugins: [new SentryWebpackPlugin()],
};Next.js
// next.config.js
const { withSentrySurface } = require("sentry-surface/next");
module.exports = withSentrySurface({
// your existing next config
});Configuration
All options can be set in .sentrynotifyrc:
| Option | Default | Description |
| -------------- | -------------------------- | ------------------------------------ |
| token | — | Sentry auth token (required) |
| org | — | Sentry org slug (required) |
| project | — | Sentry project slug (required) |
| minLevel | "error" | Minimum severity: debug, info, warning, error, fatal |
| blockBuild | false | Block builds when issues are found |
| apiUrl | https://sentry.io/api/0 | Sentry API base URL (for self-hosted)|
| pollInterval | 30000 | CLI poll interval in ms |
| maxIssues | 5 | Max issues to display |
You can also pass options directly to plugins:
sentryVitePlugin({ minLevel: "warning", maxIssues: 10 });What it looks like
╭ SENTRY ──────────────────────────────────────────────────╮
│ │
│ ⚠ [ERROR] TypeError │
│ Cannot read properties of undefined (reading 'userId')│
│ → src/api/users.ts │
│ 847 events · 312 users · first seen 2h ago │
│ │
│ ☠️ [FATAL] ReferenceError │
│ config is not defined │
│ → src/utils/config.ts │
│ 23 events · 8 users · first seen 30m ago │
│ │
│ 2 issues found │
│ │
╰──────────────────────────────────────────────────────────╯License
MIT
