Test your Crashlytics implementation (Web)

Select platform: iOS+ Android Web Flutter Unity


Use this guide if you've followed the getting started guide, and you're still not seeing crashes in the Crashlytics dashboard.

Force a crash to test your implementation

  1. Add code to your app that you can use to force a test crash.

    Add a test button or route trigger to your React, Next.js, or Angular app that throws a runtime error when clicked:

    // Trigger an unhandled exception on button click or route load
    function handleTestCrash() {
      throw new Error("Crashlytics Web SDK Test Unhandled Error!");
    }
    

    If you configured automatic error capturing with <FirebaseCrashlytics> (React or Next.js), provideCrashlytics (Angular), or <CrashlyticsRoutes> (React Router), throwing this error automatically captures the exception and schedules it for upload.

  2. Build and run your app, then trigger the test error so that your app sends its first crash report to Firebase.

  3. In the Firebase console, go to the DevOps & Engagement > Crashlytics dashboard to check for your test crash report:

    1. Select your web app from the drop-down selector at the top of the page.

    2. Refresh the page. Your test exception should appear in the Issues table within a few minutes.

If you've refreshed the console and you're still not seeing the test crash after five to ten minutes, see the next section about troubleshooting your setup.

Troubleshoot your setup

If you triggered a test crash and still don't see reports in the Crashlytics dashboard after five to ten minutes, try re-running the setup flow or verifying the following project configurations in the console:

  • Re-run the Crashlytics setup flow: You can safely re-run the Firebase CLI setup command (firebase crashlytics:setup) or complete setup in the Firebase console as described in Step 1 of the getting started guide. Re-running setup automatically enables any missing APIs and repairs the firebase-telemetry Cloud Logging bucket and routing sink.

  • Check billing and IAM permissions: Make sure that your Firebase project is on the pay-as-you-go Blaze pricing plan and that your account has Owner permissions on the project when running the setup step.

  • Verify firebasetelemetry.googleapis.com API key restrictions: In the Google Cloud console Credentials page, select the API key configured in your firebaseConfig object (for example, Browser key (auto created by Firebase)). If the key has API restrictions enabled, verify that Firebase Telemetry API (firebasetelemetry.googleapis.com) is included in the allowed APIs list. If this target is missing from a restricted API key, network upload requests fail with HTTP 403 (Forbidden) errors in your browser console.

  • Check enabled Google Cloud APIs: In the Google Cloud console Enabled APIs & services page, verify that Firebase Telemetry API (firebasetelemetry.googleapis.com), Firebase Telemetry Admin API (firebasetelemetryadmin.googleapis.com), Cloud Logging API (logging.googleapis.com), and Cloud Storage (storage.googleapis.com) are enabled for your project.

  • Verify Log Analytics on the logging bucket: In the Google Cloud console Logs Storage page, verify that the firebase-telemetry bucket (global location) exists and has Log Analytics enabled, and check the Log Router page to confirm that the firebase-telemetry-routing sink exists.

Manually capture and flush a test exception

If you want to immediately verify end-to-end transmission without waiting for memory batching or page unloads, use recordError along with flush:

import { recordError, flush, getCrashlytics } from '@firebase/crashlytics';
import { app } from './lib/firebase'; // Shared initialization script

const crashlytics = getCrashlytics(app);

async function triggerImmediateTestCrash() {
  const error = new Error("Crashlytics Web SDK Test Handled Error!");
  // Capture the error with immediate priority and custom diagnostic metadata
  recordError(crashlytics, error, {
    priority: 'IMMEDIATE',
    testEvent: true,
    environment: 'staging_verification'
  });
  // Force an immediate upload before the browser terminates or reloads
  await flush(crashlytics);
  console.log("Test error flushed to Crashlytics successfully.");
}

Next steps

  • Get readable crash reports — Set up automatic source map (.js.map) uploading so your production stack traces display original filenames and line numbers.

  • Customize crash reports — Learn how to report handled exceptions, add custom keys, force flush telemetry records, and configure sampling.