Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

JavaScript

🧩 SPA Integrations

BugSplat supports unwinding uglified and minified JavaScript stack traces via source maps. More information about configuring your application to upload source maps to BugSplat is available here.

BugSplat supports JavaScript and TypeScript error reporting in a variety of environments. We offer platform-specific integrations for Angular, React, and Node.js for your convenience.

Follow the links below for instructions on how to configure BugSplat in your application:

AngularReactVueElectronNode.js

If a platform or framework your team is leveraging is not listed above, never fear! You can leverage our bugsplat npm package to add error reporting to any browser-based app or its bugsplat/node entry point to add error reporting to any Node.js based app.

🌐 Browsers

Using the browser directly is awesome! BugSplat fully supports applications that don't use SPA frameworks. Follow the directions below to integrate with bugsplat in a browser-based JavaScript application.

⚙️ Integrating

Import bugsplat from esm.sh

<script type="module">
    import { BugSplat } from 'https://esm.sh/bugsplat@9';
</script>

Create a new instance of BugSplat with your database, application, and version

Configure bugsplat to listen to window.onerror and window.onunhandledrejection events

Trigger an error to see it reported in BugSplat

🔗 Error Chains (cause)

When you post an error that has a cause (ES2022) or an AggregateError with errors, bugsplat walks the chain (up to 100 linked errors) and sends the whole chain as the crash report. For each error, bugsplat records its type (name), message, stack, and its own enumerable properties, such as a Postgres error's code, constraint_name, and detail, or a Node.js system error's code, errno, and syscall. There is nothing to configure.

Wrap a low-level error and rethrow it; the window.onerror handler above posts the wrapper, and bugsplat captures the cause along with it

On the Crash page, the callstack starts with the frames of the error you posted. Each linked error follows as a Caused by: <type> row and then its own stack frames. Its message and properties are shown as that row's locals (toggle arguments and locals to see them). Properties of the error you posted, such as a request ID you attach before rethrowing, are added to the crash's attributes; attributes you pass to post() take precedence. The crash's Exception Code and Exception Message come from the innermost error, so a wrapper like Error: Failed to save no longer hides PostgresError: duplicate key value violates unique constraint "idx_records_email".

Grouping is unchanged: BugSplat still keys crashes on the function name and line number of the error you posted. A linked error's message is never part of a group's name, so causes that differ only in their message, such as a different address or ID, group together. If an auto-grouping rule ignores every frame of the error you posted, such as frames from node_modules, grouping continues into the linked errors' stacks and skips the Caused by: rows. If the error you posted has no stack, its first Caused by: <type> row becomes the key.

Error chain capture requires bugsplat 9.2.0 or newer.

💬 User Feedback

In addition to crash reporting, BugSplat supports collecting non-crashing user feedback such as bug reports and feature requests. Feedback reports appear in BugSplat with the "User Feedback" type, grouped by title.

You can also attach files such as screenshots:

🧪 Sample

Clone the bugsplat-js repository, which contains the my-javascript-crasher sample

Install the dependencies

Start the server

Open your browser and navigate to http://localhost:8080, then click the button to trigger an error.

📈 Viewing Reports

Navigate to the BugSplat Crashes page to view your report

BugSplat Crashes Page

Click on the ID of the most recent error to view the details of your report

BugSplat Crash Page

Last updated

Was this helpful?