Pluggable integrations that enhance Sentry JavaScript SDKs with additional error tracking, monitoring, and debugging capabilities.
—
Development-only integration for debugging Sentry events. Logs events to console and optionally triggers debugger breakpoints before events are sent. This integration should not be used in production.
/**
* Integration to debug sent Sentry events (development only)
* @param options - Debug configuration options
* @returns Integration instance for debugging events
*/
function debugIntegration(options?: DebugOptions): Integration;
interface DebugOptions {
/** Controls whether console output should be stringified. Default: false */
stringify?: boolean;
/** Controls whether debugger should launch before event sent. Default: false */
debugger?: boolean;
}/**
* Legacy class-based debug integration
* @deprecated Use debugIntegration() instead
*/
class Debug implements Integration {
constructor(options?: {
stringify?: boolean;
debugger?: boolean;
});
name: string;
setup(client: Client): void;
}When true, events and hints are JSON.stringify'd before console output:
When true, triggers a debugger statement before each event is sent:
The integration hooks into the beforeSendEvent client event and logs:
Both objects are logged either as interactive objects or JSON strings based on the stringify option.
All logging is wrapped in consoleSandbox() to prevent interference with other console integrations.
import { debugIntegration } from '@sentry/integrations';
import * as Sentry from '@sentry/browser';
// Basic debug logging
Sentry.init({
dsn: 'YOUR_DSN',
integrations: [
debugIntegration()
]
});
// Enhanced debugging with breakpoints and stringified output
Sentry.init({
dsn: 'YOUR_DSN',
integrations: [
debugIntegration({
stringify: true, // JSON stringify for easy copying
debugger: true // Pause in debugger before sending
})
]
});
// Development vs Production setup
const integrations = [];
if (process.env.NODE_ENV === 'development') {
integrations.push(debugIntegration({ debugger: true }));
}
Sentry.init({
dsn: 'YOUR_DSN',
integrations
});This integration is particularly useful during development for:
Important: Remove this integration from production builds as it adds console noise and potential performance overhead.
Install with Tessl CLI
npx tessl i tessl/npm-sentry--integrations