The Firebase Crashlytics Web SDK. This product is currently in public preview.
Functions
| Function | Description |
|---|---|
| function(app, ...) | |
| getCrashlytics(app, options) | (Public Preview) Returns the default Crashlytics instance that is associated with the provided FirebaseApp. If no instance exists, initializes a new instance with the default settings. |
| function() | |
| breadcrumbs() | (EXPERIMENTAL) Enables Crashlytics breadcrumb and trace telemetry collection when passed in CrashlyticsOptions.features.When enabled, Crashlytics collects OpenTelemetry spans (such as Fetch, XMLHttpRequest, and Document Load) and breadcrumb logs (such as navigation events, Web Vitals, user actions, and visibility lifecycle events), buffering them in memory and exporting them when an error occurs. |
| function(crashlytics, ...) | |
| flush(crashlytics) | (Public Preview) Flushes all enqueued Crashlytics data immediately, instead of waiting for default batching. |
| log(crashlytics, message, attributes) | (EXPERIMENTAL) Queues a log message to be uploaded to the Firebase Crashlytics API. |
| recordError(crashlytics, error, attributes) | (Public Preview) Queues an error to be uploaded to the Firebase Crashlytics API. |
Interfaces
| Interface | Description |
|---|---|
| Crashlytics | (Public Preview) An instance of the Firebase Crashlytics SDK.Do not create this instance directly. Instead, use getCrashlytics(). |
| CrashlyticsFeature | (EXPERIMENTAL) An opaque feature plugin object returned by Crashlytics feature factory functions such as breadcrumbs(). |
| CrashlyticsOptions | (Public Preview) Options for initializing the Crashlytics service using getCrashlytics(). |
function(app, ...)
getCrashlytics(app, options)
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Returns the default Crashlytics instance that is associated with the provided FirebaseApp. If no instance exists, initializes a new instance with the default settings.
Signature:
export declare function getCrashlytics(app?: FirebaseApp, options?: CrashlyticsOptions): Crashlytics;
Parameters
| Parameter | Type | Description |
|---|---|---|
| app | FirebaseApp | The FirebaseApp to use. |
| options | CrashlyticsOptions | CrashlyticsOptions that configure the Crashlytics instance. |
Returns:
The default Crashlytics instance for the given FirebaseApp.
Example
const crashlytics = getCrashlytics(app);
function()
breadcrumbs()
(EXPERIMENTAL) Enables Crashlytics breadcrumb and trace telemetry collection when passed in CrashlyticsOptions.features.
When enabled, Crashlytics collects OpenTelemetry spans (such as Fetch, XMLHttpRequest, and Document Load) and breadcrumb logs (such as navigation events, Web Vitals, user actions, and visibility lifecycle events), buffering them in memory and exporting them when an error occurs.
Signature:
export declare function breadcrumbs(): CrashlyticsFeature;
Returns:
Example
import { getCrashlytics, breadcrumbs } from 'firebase/crashlytics';
const crashlytics = getCrashlytics(app, {
features: [breadcrumbs()]
});
function(crashlytics, ...)
flush(crashlytics)
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Flushes all enqueued Crashlytics data immediately, instead of waiting for default batching.
Signature:
export declare function flush(crashlytics: Crashlytics): Promise<void>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| crashlytics | Crashlytics | The Crashlytics instance. |
Returns:
Promise<void>
a promise which is resolved when all flushes are complete
log(crashlytics, message, attributes)
(EXPERIMENTAL) Queues a log message to be uploaded to the Firebase Crashlytics API.
Signature:
export declare function log(crashlytics: Crashlytics, message: string, attributes?: AnyValueMap): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| crashlytics | Crashlytics | The Crashlytics instance. |
| message | string | The message to log. |
| attributes | AnyValueMap | Optional, arbitrary attributes to attach to the log. |
Returns:
void
recordError(crashlytics, error, attributes)
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Queues an error to be uploaded to the Firebase Crashlytics API.
Signature:
export declare function recordError(crashlytics: Crashlytics, error: unknown, attributes?: AnyValueMap): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| crashlytics | Crashlytics | The Crashlytics instance. |
| error | unknown | The caught exception, typically an Error object |
| attributes | AnyValueMap | Optional, arbitrary attributes to attach to the error log |
Returns:
void