Prompt

How do I set up crash reporting for a web app?

Technology / Observability1 observationLast seen Oct 20, 2026

Latest observation

Oct 20, 2026OpenAI APIWeb search: off

To set up crash reporting for a web app, you typically want to capture:

  1. JavaScript errors
  2. Unhandled promise rejections
  3. Network/API failures
  4. Performance/context data so you can reproduce issues
  5. Source maps for readable stack traces in production

1) Pick a crash/error reporting tool

Common options:

  • Sentry — very popular, easy setup, strong JS support
  • Datadog RUM
  • Bugsnag
  • Rollbar
  • Firebase Crashlytics is more mobile-focused, not ideal for web

If you want the simplest path, Sentry is a good default.

2) Install the SDK

Example with Sentry:

npm install @sentry/browser

3) Initialize it early in your app

Put this near the top of your app startup code:

import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  environment: process.env.NODE_ENV,
  release: "my-app@1.0.0",
});

4) Capture errors automatically

Most SDKs will automatically capture:

  • uncaught exceptions
  • unhandled promise rejections
  • some framework errors

You can also manually report errors:

try {
  doSomething();
} catch (err) {
  Sentry.captureException(err);
}

5) Add request/API error tracking

If your app uses fetch, you can wrap requests and report failed ones:

async function apiFetch(url, options) {
  const res = await fetch(url, options);
  if (!res.ok) {
    Sentry.captureMessage(`API error: ${res.status} ${url}`, "error");
  }
  return res;
}

For better observability, include:

  • URL
  • status code
  • request ID
  • user/session context

6) Attach useful context

When a crash happens, you want to know who/what/where:

Sentry.setUser({ id: "123", email: "user@example.com" });
Sentry.setTag("feature", "checkout");
Sentry.setContext("cart", { items: 3, total: 49.99 });

7) Upload source maps

If you use a bundler like Vite, Webpack, or Next.js, enable source maps for production builds and upload them to your error tool. This converts minified stack traces into readable code locations.

Examples:

  • Vite: build.sourcemap = true
  • Webpack: devtool: "source-map"

Then configure your error service to ingest those source maps during CI/CD.

8) Protect privacy

Be careful not to send:

  • passwords
  • tokens
  • credit card data
  • personal info in request payloads

Most tools let you scrub or filter sensitive fields before sending events.

9) Test it

Deliberately trigger a test error:

throw new Error("Test crash reporting");

Then confirm it appears in your dashboard with a readable stack trace.

10) Optional: add session replay and breadcrumbs

Helpful features:

  • breadcrumbs: recent user actions before the crash
  • session replay: video-like playback of what happened
  • logs: correlate frontend errors with backend logs

If you want, I can give you a setup example for a specific framework like React, Next.js, Vue, or plain JavaScript.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.