
Sentry Capacitor SDK
https://github.com/getsentry/sentry-capacitor- Category
- Developer Tools
- Rank
- No. 417Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- getsentry
- GitHub
- 147 stars
- Latest release
- 4.3.0
- Date
About
Official Sentry SDK for Capacitor — crash reporting and error monitoring for Ionic and hybrid mobile apps.
What it does
It coordinates Sentry’s JavaScript layer with Capacitor’s native bridge. Initialization starts the native SDK first, then the chosen framework SDK. Events travel as encoded envelopes, while users, tags, extras, contexts, and breadcrumbs stay synchronized across layers.
Why it's ranked here
A strong choice for Capacitor teams already using Sentry’s browser or framework tooling. It preserves native crash handling without abandoning JavaScript instrumentation, falls back to JavaScript-only operation when native startup fails, and exposes controls for sessions, tracing, failed requests, privacy, hangs, and native logs.
What's good
The bridge handles more than crash delivery. It synchronizes scope data, enriches events with native device and release details, and supports manual events, tracing, measurements, metrics, breadcrumbs, and shutdown flushing. Native transport becomes the default on mobile, while web operation disables native behavior automatically.
Tradeoffs
Framework integration requires a sibling Sentry package, with exact peer versions declared for Angular, React, and Vue. Older Angular projects need an earlier SDK generation. Native data-collection controls remain incomplete, Android stores contexts as extras, and experimental metrics currently cover web and iOS rather than Android.
How to use it well
Use it in Capacitor applications that need one Sentry setup spanning JavaScript and native mobile failures. Initialize it early, pair it with the matching Angular, React, Vue, or browser package, and add useful user, tag, context, and breadcrumb data. It does not replace that sibling framework SDK.
Technical notes+
src/sdk.ts builds shared browser and native options, selects makeNativeTransport off web, installs a TextEncoder polyfill when needed, and enables scope synchronization. src/client.ts initializes NATIVE.initNativeSdk before the sibling SDK, restores non-native options after failure, and then annotates SDK metadata. src/wrapper.ts serializes envelopes, base64-encodes them, and sends them through the Capacitor plugin registered in src/plugin.ts. src/scopeSync.ts wraps Scope mutators to mirror users, tags, extras, contexts, and breadcrumbs. Platform and experimental constraints are declared in src/options.ts and filtered for the bridge by src/nativeOptions.ts.
Observed
- License
- MIT
- Primary language
- TypeScript
- Install surface
- Public npm package @sentry/capacitor, installed with a Sentry framework or browser sibling package
- Interface
- TypeScript library backed by a registered Capacitor native plugin bridge
- Platform support
- Web, iOS, and Android behavior is present; native logging supports iOS and Android
- Native packaging
- Published files include iOS and Android sources, a Swift package manifest, and a CocoaPods specification
- Compatibility surface
- Requires Capacitor core 3 or newer; Angular, React, and Vue sibling peer dependencies are optional
Read from README.md, package.json, src/index.ts, src/sdk.ts, src/client.ts, src/plugin.ts, src/options.ts, src/version.ts, src/wrapper.ts, src/scopeSync.ts, src/breadcrumb.ts, src/definitions.ts, src/nativeOptions.ts, src/NativeLogListener.ts, src/integrations/index.ts.
What it can do
Capture and report application crashes
Mobile app crash events → Detailed crash reports with stack traces
Monitor and track runtime errors
JavaScript errors and exceptions → Error event logs with context data
Track application performance metrics
App performance data and transactions → Performance monitoring reports
Capture custom events and breadcrumbs
User-defined events and application state changes → Timeline of events leading to issues
Filter and sample error events
Raw error data and filtering rules → Curated subset of relevant errors
Attach user context and tags to events
User information and custom metadata → Enriched error reports with contextual data
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.