Firebase Adapter
Forward captured errors to a Firebase project (Firebase app + analytics events).
Install
yarn add firebase
Activate
import { initialize, useAdapter } from 'unified-error-handling';
initialize();
await useAdapter('firebase', {
firebaseConfig: {
apiKey: 'your-api-key',
authDomain: 'your-app.firebaseapp.com',
projectId: 'your-app',
appId: 'your-app-id',
measurementId: 'G-XXXXXXX',
},
});
Config
| Field | Purpose |
|---|---|
firebaseConfig | Your standard Firebase web config object (apiKey, authDomain, projectId, appId, measurementId, …). |
The adapter initializes a Firebase app and, where available, Firebase Analytics. Analytics initialization is guarded — if it is not available in the current environment, the adapter continues without it instead of failing.
Notes
firebaseis loaded dynamically on activation. If it is not installed, activation throwsFailed to load Firebase SDK…with the original error ascause.- The web Firebase SDK surfaces analytics events; native crash reporting (Crashlytics) on iOS/Android is a native concern outside this web adapter's scope.
- Provide
measurementIdif you want analytics events recorded.
note
This adapter uses the standard firebase web SDK directly. It does not depend on @capacitor-firebase/crashlytics or @capacitor-firebase/performance.