Mobile SDK

Error monitoring for React Native

A pure-JS package — no native modules, no pod install, no Gradle wiring. It hooks the global error handler and unhandled promise rejections. (For native crashes, run the platform SDKs alongside.)

Frameworks React NativeRequires React Native 0.70+Package @errorgap/react-nativeSource ↗Package ↗Agent guide ↗
Install

Install

sh
npm install @errorgap/react-native
No native modules ship in v1 — nothing to link. Native crash reporting is pending; use the platform SDKs alongside for native crashes.
Configure

Configure

In your entry file (index.js / App.tsx):

ts
import { Errorgap } from "@errorgap/react-native";
import { Platform } from "react-native";

Errorgap.init({
  endpoint:    "https://your-endpoint",
  projectSlug: "your-project",
  apiKey:      "egp_...",
  environment: __DEV__ ? "development" : "production",
  deviceInfo: {
    os_name:    Platform.OS,
    os_version: String(Platform.Version),
  },
});

The SDK hooks ErrorUtils.setGlobalHandler and unhandled promise rejections automatically.

Session replay

Session replay

Version 0.5.0 records session replay. Mobile sessions are a timeline only — app start, screens, failed API calls, errors and backgrounding — with no screenshots. Whether anything is recorded is set per project in Errorgap under Settings → Session replay: nothing while replay is off, and a sampled share of sessions while it is on. Only sessions that hit an error are kept, and each opens from its error group or incident.

tsx
const ref = useNavigationContainerRef();
const onNavigation = Errorgap.errorgapNavigationListener(ref);

<NavigationContainer ref={ref} onReady={onNavigation} onStateChange={onNavigation}>
Trigger a test error

Trigger a test error

tsx
<Button title="Test Errorgap" onPress={() => { throw new Error("Errorgap test error"); }} />
Verify

Verify the connection

Confirm your key and endpoint reach errorgap before wiring anything else — send one event straight to the ingestion API:

bash
curl -sS -X POST "$ERRORGAP_ENDPOINT/api/projects/$ERRORGAP_PROJECT_SLUG/notices" \
  -H "content-type: application/json" \
  -H "x-errorgap-project-key: $ERRORGAP_API_KEY" \
  -d '{"errors":[{"type":"ErrorgapInstallTest","message":"Errorgap install verification"}]}'

A 201 with a group_id means ingestion works (202 = received but sampled; 401 = wrong key). Then trigger the test error above through the SDK. Your onboarding screen's Verify step checks the stack off automatically once the first event lands — it polls every three seconds.

Next: the full ingestion API, or browse every SDK.