docs: rewrite the Electron integration around @bugsplat/electron - #334
docs: rewrite the Electron integration around @bugsplat/electron#334bobbyg603 wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KoWGNtyTyAq184QWQ2aquX
There was a problem hiding this comment.
Pull request overview
Updates the Electron integration documentation to center on the new @bugsplat/electron package, describing a single init()-based setup and documenting how it captures native crashes, JS errors, hangs, OOM events, and process-gone signals.
Changes:
- Replaces the legacy
crashReporter.start+bugsplat-node+ per-renderer setup with a main-processinit()quick start and a rendererinit()snippet. - Adds an options overview, “how it works” capture matrix, and renderer setup notes (CSP, sandbox/context isolation, Document-Policy for hang stacks).
- Updates symbols/source maps guidance to use client credentials and adds an upgrade section for existing integrations.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| bugsplat.setUser('fred@bedrock.com'); | ||
| bugsplat.setAttribute('plan', 'pro'); |
| * **One identity everywhere**: the user, email, application key, description and attributes you set in main or in a renderer are applied to native crash keys in every process and to every JavaScript report. | ||
|
|
||
| BugSplat-node can also be used to collect [uncaughtException](https://nodejs.org/api/process.html#process\_event\_uncaughtexception) and [unhandledRejection](https://nodejs.org/api/process.html#process\_event\_unhandledrejection) events in your application's JavaScript code. | ||
| `@bugsplat/electron` supports Electron 35 and later. It replaces the previous two-step integration of `electron.crashReporter` plus [bugsplat-node](../cross-platform/node.js.md); see [Upgrading](#upgrading-from-crashreporter-and-bugsplat-node) below if you use that today. |
| | JavaScript error in main | `uncaughtException` / `unhandledRejection` | JavaScript report | | ||
| | JavaScript error in a renderer | `window` `error` / `unhandledrejection` → preload bridge → IPC → main | JavaScript report with the renderer call stack, URL and title | | ||
| | Renderer hang | `unresponsive` + `WebFrameMain.collectJavaScriptCallStack()` | `RendererUnresponsive` report grouped by the hung JS frame | | ||
| | Renderer out of memory | Electron ≥ 42 writes `electron.v8-oom.*` crash keys | Minidump with `electron.v8-oom.stack` and heap statistics | |
| ``` | ||
|
|
||
| You may see the following error in the console: | ||
| * If your renderer is built with React or Angular, keep using [@bugsplat/react](../web/react.md) or [bugsplat-ng](../web/angular.md) for component-tree errors. The renderer client is a `BugSplat` instance, so `@bugsplat/react`'s `ErrorBoundary` can reuse it via `scope={{ getClient }}`. |
…ctron-crasher Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KoWGNtyTyAq184QWQ2aquX
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KoWGNtyTyAq184QWQ2aquX
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (4)
Previously missed (3) — in code that hasn't changed since the last review.
introduction/getting-started/integrations/desktop/electron.md:74
- The no-bundler renderer instructions are inconsistent: the script tag loads
./vendor/renderer.global.js, but the next sentence says to copy the file “next to your page”. As written, a reader may copy it to the wrong location and get a 404.
Copy `node_modules/@bugsplat/electron/dist/renderer.global.js` next to your page at build time.
introduction/getting-started/integrations/desktop/electron.md:159
- This
withJsCallStackPolicyexample usesprotocol,net, andpathToFileURLwithout importing them, andfileFor(...)is undefined. As-is, it's not copy/paste runnable and may confuse readers; making the imports explicit and clarifying the URL→file mapping helps.
import { withJsCallStackPolicy } from '@bugsplat/electron';
protocol.handle('app', async (request) => {
const response = await net.fetch(pathToFileURL(fileFor(request.url)).toString());
return new Response(response.body, {
introduction/getting-started/integrations/desktop/electron.md:93
- The Options snippet calls
init({ ... })without importinginit, and it appears immediately after a renderer-onlyinit()example. Adding the import inside the code block makes the snippet self-contained and clarifies that this is the main-process initializer.
init({
database: 'fred',
application: 'my-electron-app', // defaults to app.name
introduction/getting-started/integrations/desktop/electron.md:17
- The link to the Node.js integration points to
../cross-platform/node.js.md, but there is nointegrations/cross-platformdirectory in this repo. This will render as a broken link; it likely should target the existing Node.js page underintegrations/web/node.js.md.
`@bugsplat/electron` supports Electron 35 and later. It replaces the previous two-step integration of `electron.crashReporter` plus [bugsplat-node](../cross-platform/node.js.md); see [Upgrading](#upgrading-from-crashreporter-and-bugsplat-node) below if you use that today.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (3)
Previously missed (1) — in code that hasn't changed since the last review.
introduction/getting-started/integrations/desktop/electron.md:47
- The main-process quick start mixes ESM (
import) with CommonJS (require('./package.json')) and assumes the main script sits next topackage.json. That’s not true for many Electron/TS setups (e.g.src/main.ts), so copying this snippet can fail. Sinceapplication/versionalready default toapp.name/app.getVersion(), the example can avoidpackage.jsonentirely and stay consistent ESM.
This issue also appears on line 155 of the same file.
import { init } from '@bugsplat/electron';
const { database, name, version } = require('./package.json');
const bugsplat = init({ database, application: name, version });
introduction/getting-started/integrations/desktop/electron.md:17
- This internal link points to
../cross-platform/node.js.md, but there is nointegrations/cross-platformdirectory in this repo (the Node.js integration doc lives underintegrations/web/node.js.md). As written, the link will 404 in the published docs.
`@bugsplat/electron` supports Electron 35 and later. It replaces the previous two-step integration of `electron.crashReporter` plus [bugsplat-node](../cross-platform/node.js.md); see [Upgrading](#upgrading-from-crashreporter-and-bugsplat-node) below if you use that today.
introduction/getting-started/integrations/desktop/electron.md:155
- This snippet calls
fileFor(request.url), butfileForisn’t defined anywhere in the doc (and doesn’t appear elsewhere in the repo), so readers can’t run this as-is.
const response = await net.fetch(pathToFileURL(fileFor(request.url)).toString());
Summary
Rewrites the Electron integration page (
introduction/getting-started/integrations/desktop/electron.md, same path) around the new@bugsplat/electronpackage: oneinit()in the main process replaces the separatecrashReporter.start()+bugsplat-node(+bugsplatin each renderer) setup.connect-srcneeded,Document-Policyrecipe for hang call stacks, React/Angular note-i/-sclient credentials instead of the deprecated-u/-pusername/password flagsMerge once
@bugsplat/electronis published to npm (tracked in BugSplat-Git/bugsplat-electron).🤖 Generated with Claude Code
https://claude.ai/code/session_01KoWGNtyTyAq184QWQ2aquX