1k-sentry
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 // Electron desktop app
platformEnv.isNative // React Native (iOS/Android)
platformEnv.isWeb // Web browser
platformEnv.isExtension // Browser extension
platformEnv.isWebEmbed // Embedded web components
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
- Native crashes →
Add Custom Context
import * as Sentry from '@sentry/react-native'; // or @sentry/browser
// Add breadcrumb
Sentry.addBreadcrumb({
category: 'action',
message: 'User clicked button',
level: 'info',
});
// Set user context
Sentry.setUser({ id: 'user-id' });
// Set tags
Sentry.setTag('feature', 'swap');
// Capture exception with context
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
// Filter by error type
const FILTERED_ERROR_TYPES = new Set(['AxiosError', 'HTTPClientError']);
// Filter by exact message
const FILTER_ERROR_VALUES = ['AbortError: AbortError'];
// Filter by pattern (in isFilterErrorAndSkipSentry function)
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
More from onekeyhq/app-monorepo
react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
109implementing-figma-designs
Implements Figma designs 1:1 using OneKey component library (还原设计稿).
77pr-review
Security-first PR review checklist for this repo. Use when reviewing diffs/PRs, especially changes involving auth, networking, sensitive data, or dependency/lockfile updates. Focus on secret/PII leakage risk, supply-chain risk (npm + node_modules inspection), cross-platform architecture (extension/mobile/desktop/web), and React performance (hooks + re-render hotspots). Avoid UI style nitpicks. PR Review.
62auditing-pre-release-security
Audits security and supply-chain risk between two git refs, 预发布安全审计
611k-error-handling
Error handling patterns — try/catch, async errors, error boundaries, useAsyncCall, and toast messages.
551k-new-skill
Creates a new Claude Code Skill following best practices. Use when the user wants to create a new skill, add a skill, or asks about writing skills for Claude Code. Fetches latest documentation before generating skill content. New skill. Create a skill.
51