Expo

Altix ErrorTrack unterstützt das Sentry-Protokoll, sodass Sie das offizielle @sentry/react-native-SDK verwenden. Die folgenden Code-Snippets nutzen einen Platzhalter-DSN; auf der Einrichtungsseite Ihres Projekts finden Sie die echten Werte.

  1. SDK installieren

    Fügen Sie @sentry/react-native hinzu, das offizielle Sentry-SDK. Es funktioniert unverändert mit Altix ErrorTrack.

    bash

    npx expo install @sentry/react-native
  2. Konfigurieren

    Initialisieren Sie das SDK so früh wie möglich in Ihrer App mit Ihrer DSN.

    app.json

    {
      "expo": {
        "plugins": [
          [
            "@sentry/react-native/expo",
            { "url": "https://errortrack.altixcode.com", "organization": "<org-slug>", "project": "<project-slug>" }
          ]
        ]
      }
    }

    app/_layout.tsx

    import { Stack } from "expo-router";
    import * as Sentry from "@sentry/react-native";
    
    Sentry.init({
      dsn: "https://<public-key>@errortrack.altixcode.com/<project-id>",
      tracesSampleRate: 1.0,
    });
    
    function RootLayout() {
      return <Stack />;
    }
    
    export default Sentry.wrap(RootLayout);
  3. Source Maps hochladen

    Damit Stacktraces Ihren Originalcode statt des minifizierten Codes anzeigen. Erstellen Sie unter Einstellungen → Auth-Tokens ein Auth-Token mit dem Scope project:releases und bewahren Sie es in Ihren CI-Secrets auf – niemals im Repository.

    bash

    # The Expo plugin above uploads Hermes source maps from the native builds
    # (Xcode and Gradle) when this is set in the build environment:
    export SENTRY_AUTH_TOKEN=<an auth token from Settings → Auth Tokens>
    # They go to https://errortrack.altixcode.com, the url set in app.json.

    Source-Maps-Anleitung

  4. Überprüfen

    Lösen Sie absichtlich einen Fehler aus. Er erscheint innerhalb weniger Sekunden in Ihrem Issue-Stream.

    javascript

    throw new Error("My first ErrorTrack error");
  5. Native Debug-Dateien (dSYM, NDK/ELF, PDB und Breakpad-Symbole) werden derzeit noch nicht verarbeitet. Fehler werden weiterhin empfangen und gruppiert, native Frames bleiben jedoch unlesbar, bis dieses Feature verfügbar ist.

Erstellen Sie ein Projekt, und auf der Einrichtungsseite wird automatisch Ihre echte DSN eingetragen.