| name | 1k-sentry |
| description | Sentry error tracking and monitoring for OneKey. Use when configuring Sentry, filtering errors, analyzing crash reports, or debugging production issues. Covers platform-specific setup (desktop/mobile/web/extension) and error filtering strategies. |
Sentry Integration
OneKey uses Sentry for error tracking across all platforms.
Architecture Overview
apps/
โโโ desktop/app/sentry.ts # Desktop main process
โโโ ext/ # Extension (uses shared)
โโโ mobile/ # Mobile (uses shared)
โโโ web/ # Web (uses shared)
packages/shared/src/modules3rdParty/sentry/
โโโ index.ts # Web/Extension entry
โโโ index.native.ts # React Native entry
โโโ index.desktop.ts # Desktop renderer entry
โโโ basicOptions.ts # Shared config & error filtering
โโโ instance.ts # Sentry client instance
Platform Detection
import platformEnv from '@onekeyhq/shared/src/platformEnv';
platformEnv.isDesktop
platformEnv.isNative
platformEnv.isWeb
platformEnv.isExtension
platformEnv.isWebEmbed
Common Tasks
Filter/Ignore Errors
See: references/rules/ignoring-errors.md
Key file: packages/shared/src/modules3rdParty/sentry/basicOptions.ts
Analyze Crash Reports
- Get crash details from Sentry dashboard
- Identify error type, message, and stack trace
- Check platform-specific context
- Use related skills for fixes:
- Native crashes โ
/1k-patching-native-modules
- JS errors โ Fix in codebase
Add Custom Context
import * as Sentry from '@sentry/react-native';
Sentry.addBreadcrumb({
category: 'action',
message: 'User clicked button',
level: 'info',
});
Sentry.setUser({ id: 'user-id' });
Sentry.setTag('feature', 'swap');
Sentry.captureException(error, {
extra: { additionalData: 'value' },
});
Key Files
| Purpose | File |
|---|
| Error filtering | packages/shared/src/modules3rdParty/sentry/basicOptions.ts |
| Desktop main | apps/desktop/app/sentry.ts |
| Desktop renderer | packages/shared/src/modules3rdParty/sentry/index.desktop.ts |
| Web/Extension | packages/shared/src/modules3rdParty/sentry/index.ts |
| Native | packages/shared/src/modules3rdParty/sentry/index.native.ts |
Error Filtering Quick Reference
const FILTERED_ERROR_TYPES = new Set(['AxiosError', 'HTTPClientError']);
const FILTER_ERROR_VALUES = ['AbortError: AbortError'];
if (error.value?.includes('PATTERN')) return true;
Related Skills
/1k-patching-native-modules - Fix native crashes found in Sentry
/1k-coding-patterns - Error handling best practices