LogoLogo
HomePlatform IntegrationsDownloadsLogin
  • Welcome
  • 📌Introduction
    • Getting Started
      • Signing Up
      • Creating a Database
      • Platform Integrations
        • 💻Desktop
          • BugSplat Crash Reporting Library for Windows (Native C++)
            • Full Memory Dumps
            • Windows (Native C++) Dependencies
          • Windows (.NET Framework)
          • macOS
          • Linux
        • 🔀Cross-Platform
          • .NET Standard
          • Breakpad (Deprecated)
          • Crashpad
            • How to Build Google Crashpad
          • Deno
          • Electron
          • Java
          • Node.js
          • Python
          • Qt
        • 🎮Game Development
          • CRYENGINE
          • Nintendo Switch
          • PlayStation
          • Unreal Engine
            • Unreal Engine Plugin
          • Unity
          • Xbox
        • 📱Mobile
          • Android
          • Ionic
          • iOS
          • React Native
        • 🕸️Web
          • Angular
          • JavaScript
          • React
          • Vue
        • ⌛Downloads
      • Platform Samples
        • BugSplatTester (iOS)
        • BugSplatTester (macOS)
        • myConsoleCrasher (C++)
          • Address Sanitizer Reports
        • my-android-crasher
        • my-angular-crasher
        • my-electron-crasher
        • my-java-crasher
        • my-node-crasher
        • my-qt-crasher
        • my-react-crasher
        • my-unity-crasher
        • my-unreal-crasher
      • Inviting Team Members
      • Importing Crashes
      • Troubleshooting
      • Quickly Submitting Your First Crash in Under 5 Minutes
    • Development
      • Using the App
      • Symbol Files
        • Common Symbols
        • How to Manually Upload Symbols
        • Source Maps
        • Symbol Servers
        • Working with Symbol Files in Windows Environments
      • Searching
        • Table Filtering
        • Table Grouping
      • Grouping Crashes
      • Commenting
      • Integrations and Third Party Tools
        • Configurable Alerts
          • Slack
          • Microsoft Teams
          • Discord
          • Email
          • Webhook
        • Issue Trackers
          • Azure DevOps
          • Favro
          • Jira
          • GitHub Issues
          • GitLab
          • Monday.com
          • YouTrack
          • Auto-Creating Defects from BugSplat Databases in Attached Third-Party Issue Trackers
      • API
        • Web Application Endpoints
          • Charting
          • Company
          • Crash
          • Crashes
          • Crash Groups
          • Databases
          • Defect
          • Events
          • Import/Migrate
          • Support Response
          • User (GDPR)
          • Users
          • Versions
        • Crash Post Endpoints
        • OAuth2
        • Defect Tracker Options
        • Paging, Filtering, and Grouping
        • Platform Specific API's
          • C++ Native API
          • .NET API
    • Production
      • Versions
      • 🆕Regression Alerts
      • Security and Compliance
        • Security Program
        • BugSplat Security Program Inquirys
        • SOC 2
        • GDPR & UK GDPR Compliance
        • Avoid Collecting Personally Identifiable Information (PII)
        • Crash Expiry
        • Terms
        • Privacy Policy
      • Support Responses
      • BugSplat Status
  • 🍎Education
    • BugSplat Terminology
    • How-Tos
      • Creating Defects
      • Contacting End-Users
      • Crash Dialog Branding
      • Reprocess Crashes
      • Batch Reprocess Crashes
      • Using the Crash Attribute Feature
      • Send Feedback
      • Remove Crashes
    • Videos
      • BugSplat Product Walkthrough
    • FAQs
      • How Do I Upload Crashes with Python?
      • How Do I Remove Symbol Files?
      • Crash details 'Active Thread'
      • How long does it take to process a crash?
      • How BugSplat handles large crash volumes
      • How Does Crash Rate Limiting Work?
      • Add Custom Branding to Support Response
      • Finding Missing Reports
      • Using Dark Mode
      • What If My App or Game Grows Quickly?
      • Does BugSplat have an effect on application performance?
      • Manually Upload Crash Reports to BugSplat
      • How to configure proxy settings in BugSplat
      • Using BugSplat's public database
      • How to Upload Symbol Files with Symbol-Upload
      • Using SendPdbs to Automatically Upload Symbol Files
      • Managing Symbol Space
      • Why Group Crashes?
      • Uploading third-party DLLs without PDB files
      • Localized Support Responses for Windows C++, .NET, and macOS
      • BugSplat application uptime data
        • What are the upload size considerations with BugSplat accounts.
      • Is an application's source code safe when using BugSplat?
      • How to get correct callstacks with BugSplat in Steam
      • What is a crash reporter?
      • Common End-User Questions
        • Missing BugSplat.dll
        • What should I do if I get a BugSplat?
        • What is BsSndRpt.exe?
        • My software just crashed. Should I contact BugSplat for help?
  • 🏢Administration
    • Billing
      • Free Trial Overview
      • Plans and Billing Overview
      • How to Sign Up for a BugSplat Plan
      • Viewing Account Usage
      • Upgrading, Changing, or Canceling Your Plan
        • Upgrading or Downgrading Your Plan
        • Adding Additional Crashes and Storage Space
        • Updating Credit Card and Billing Information and Viewing Billing History
        • Updating Tax and VAT Information
        • Canceling Your Plan
      • Free and Discounted Plans
        • Free Plan Overview
        • Free Crash Reporting for Indie Game Development
        • Education
        • Open-Source
        • Good Causes
      • Plans, Upgrades, and Payments FAQ
        • Fair-Refund Policy
        • Update to Our Legacy Plans Guide
        • Updates to BugSplat Pricing Plans - March 2024
        • Using Coupons and Promotions at BugSplat
        • What is 'High Volume Fractional Crash Processing'?
    • Account
      • Migrating Databases
      • Deleting Databases
      • Deleting a Company Account
      • Changing Company Name
    • User Management
      • User Permissions
      • Deleting a User
      • Requesting Access
      • Login Page and Options
      • Password Settings and Reset Options
        • Required Password Reset - August 4th, 2023
      • Single Sign-On (SSO)
      • Multi-Factor Authentication (MFA)
      • Enforce MFA
      • Adding New Users in Companies with Multiple Databases
    • Contact us
  • 🐛About
    • What is BugSplat?
    • Why BugSplat?
    • Who is BugSplat?
      • Our Values
      • Charitable Giving
      • Brand Guidelines
    • Partnerships
    • Misc
      • Promotions
        • March 2024 - Game Developer Free Months of Service
      • Giveaways
        • April 8 - April 22, 2025
        • Feb 18 - March 17, 2025
        • Jan 15 - Feb 13, 2025
        • December 19-29, 2024
        • November 21–28, 2024
        • October 17-24th, 2024
        • September 19-26th, 2024
        • July 18 - July 23, 2024
        • April 18 - May 12, 2024
        • March 18 - April 03, 2024
        • November 15-30, 2023
        • October 9-23, 2023
  • 🔀Changelog
    • Changelog
Powered by GitBook
On this page
  • Overview 👀
  • Native (C++) Crash Reporting ⚙️
  • Update Package.json
  • Configure Crash Reporter
  • Generate a Crash
  • View BugSplat Crash Report
  • Optional: Upload Native Addon Symbols
  • JavaScript/TypeScript Error Reporting 💥
  • Installing bugsplat-node
  • Configuration
  • Main Thread
  • Renderer Thread
  • Uploading Source Maps
  • Viewing Error Reports
  • Contributing 🤝

Was this helpful?

  1. Introduction
  2. Getting Started
  3. Platform Integrations
  4. Cross-Platform

Electron

PreviousDenoNextJava

Last updated 6 months ago

Was this helpful?

Overview 👀

Want to see a sample Electron application integrated with BugSplat? Check out !

BugSplat supports the collection of both (native) and crash reports. Native crashes are generated via and BugSplat requires symbol files in order to calculate the call stack.

BugSplat will automatically resolve Electron framework symbol files when calculating call stacks. However, if your application includes native add-ons or is packaged with you will need to upload application-specific symbol files to see full native call stacks. All symbol files must be uploaded to BugSplat via , , or manually via the . More information about uploading symbol files to BugSplat can be found .

BugSplat-node can also be used to collect and events in your application's JavaScript code.

Native (C++) Crash Reporting ⚙️

Configure to upload crash reports to BugSplat using the following steps. BugSplat will automatically download Electron and Electron Framework symbol files. If your application uses , you will need to generate and upload symbol files to resolve call stacks correctly.

Update Package.json

Add a database property with the value of your BugSplat database to package.json. Be sure to replace your-bugsplat-database with the actual value of your BugSplat database.

{
    ...
    "database": "your-bugsplat-database"
}

Configure Crash Reporter

Next, call crashReporter.start as shown in the example below. You may optionally pass globalExtra values for key, email, comments, notes, and ipAddress.

Note that the globalExtra fields will be sent with crashes captured on all processes:

const { crashReporter } = require("electron");
const { database, name, version } = require("../../package.json");
crashReporter.start({
  submitURL: `https://${database}.bugsplat.com/post/electron/v2/crash.php`,
  ignoreSystemCrashHandler: true,
  uploadToServer: true,
  rateLimit: false,
  globalExtra: {
    "product": name,
    "version": version,
    "key": "en-US",
    "email": "fred@bugsplat.com",
    "comments": "BugSplat rocks!",
  }
})

Generate a Crash

Generate a crash in one of the Electron processes to test your BugSplat integration:

process.crash()

View BugSplat Crash Report

Optional: Upload Native Addon Symbols

npx symbol-upload -u you@email.com -p password -d ./dist -f "**/*.node" -m

JavaScript/TypeScript Error Reporting 💥

Installing bugsplat-node

Install bugsplat-node via the following command:

npm i bugsplat-node

Configuration

Next import or require BugSplat in both your main and renderer threads.

import { BugSplatNode as BugSplat } from "bugsplat-node"
const bugsplat = new BugSplat(database, name, version)

In addition to the configuration demonstrated above, there are a few public methods that can be used to customize your BugSplat integration:

bugsplat.setDefaultAppKey(appKey); // Additional metadata that can be queried via BugSplat's web application
bugsplat.setDefaultUser(user); // The name or id of your user
bugsplat.setDefaultEmail(email); // The email of your user 
bugsplat.setDefaultDescription(description); // A description placeholder that can be overridden at crash time
bugsplat.setDefaultAdditionalFilePaths([paths]); // Paths to files to be sent to BugSplat at post time (limit 1MB) 
bugsplat.postAndExit(error, options); // Wrapper for post that calls process.exit(1) after posting error to BugSplat
bugsplat.post(error, options); // Aysnc function that posts an arbitrary Error object to BugSplat
// If the values options.appKey, options.user, options.email, options.description, options.additionalFilePaths are set the corresponding default values will be overwritten
// Returns a promise that resolves with properties: error (if there was an error posting to BugSplat), response (the response from the BugSplat crash post API), and original (the error passed by bugsplat.post)

Main Thread

Create an error handler for uncaughtExceptions and unhandledPromise rejections. We recommend you quit your application in the event of an uncaughtException or unhandledPromiseRejection. You may also want to add code to display a message to your user here:

const javaScriptErrorHandler = async (error) => {
  await bugsplat.post(error);
  app.quit();
}

Add the error handler created above to uncaughtException and unhandledPromiseRejection events:

process.on('unhandledRejection', javaScriptErrorHandler)
process.on('uncaughtException', javaScriptErrorHandler)

Renderer Thread

Reloading or quitting the application is sometimes desirable when an error occurs in the renderer process. The following is an example of how to invoke the main process from the renderer and quit your application in the case of an unhandled exception in the renderer:

window.onerror = async (messageOrEvent, source, lineno, colno, error) => {
await bugsplat.post(error)
  ipcRenderer.send('rendererCrash')
}
import { ipcMain } from "electron";
ipcMain.on('rendererCrash', function () {
  // Display an error and reload or quit the app here
})

Test BugSplat by throwing a new error in either the main or renderer process:

throw new Error("BugSplat!");

You may see the following error in the console:

Refused to connect to 'https://fred.bugsplat.com/post/js/' because it violates the following Content Security Policy directive: "default-src 'self'". 

If you see this error, modify your index.html file to allow report upload from the renderer process:

<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; connect-src 'self' https://your-database.bugsplat.com 'unsafe-eval'"/>

Uploading Source Maps

To upload source maps, add a symbol-upload script that uploads all your build's .js.map files:

{
  ...
  "scripts": {
    "upload-source-maps": "npx symbol-upload -u you@email.com -p password -d ./dist -f \"**/*.js.map\""
  }
}

Viewing Error Reports

That’s it! Your Electron application is now configured to upload crash reports to BugSplat.

Contributing 🤝

For more information on configuring electron.crashReporter including adding properties to individual processes, please see the .

Navigate to the page in BugSplat. You should see a new crash report for your application. Click the link in the ID column to see details about your crash on the page:

If your application uses a , you must generate and upload symbols for each binary and for every build.

Use and the -m argument to generate and upload .sym files from your application binaries automatically. You can run symbol-upload without any arguments to view all available options.

Alternatively, you can add a build step to generate and upload .sym files for your node native addon using standard Breakpad tools. To generate symbol files, you can run with a path to a .node file after the Node Native Module build or rebuild step if you're using a tool like . Once you've generated a .sym file for your .node native module, the .sym file can be uploaded via , or manually on the page.

Verify that your node native addon .sym files show up on the page. Be sure to upload symbols for each released version of your application. Integrate or into your build and release processes for best results.

To configure reporting of JavaScript or TypeScript errors in your main and renderer processes, please see our documentation for installing and configuring .

Many Electron applications run multiple node.js processes. For instance, the application runs both a and a process. You must require bugsplat in each process you want to capture errors. To capture errors in the renderer process, add the following to renderer.js:

If you're using TypeScript or another language that compiles to JavaScript, BugSplat can map uglified and minified JavaScript function names, file names, and line numbers back to their original values via .

Run your application and generate an error report. Navigate to the page in BugSplat to view reports for the application you just configured. Click the link in the ID column to see details about your crash on the page:

BugSplat loves open-source software! If you have suggestions on how we can improve this integration, please reach out to support@bugsplat.com, create an in our or send us a .

📌
🔀
Electron crashReporter documentation
Crashes
Crash
node native addon
node.js
bugsplat-node
Node.js
electron-quick-start
main
renderer
renderer.ts
main.ts
source maps
Crashes
Crash
issue
GitHub repo
pull request
my-electron-crasher
electron.crashReporter
node.js
Crashpad
electron-builder
@bugsplat/symbol-upload
symupload
Versions page
uncaughtException
unhandledRejection
electron.crashReporter
Native Node Modules
electron-rebuild
Versions
Versions
@bugsplat/symbol-upload
@bugsplat/symbol-upload
here
dump_syms
symupload
symupload
Electron Native Crashes
Electron Native Crash
TypeScrpt Error on Crashes Page
TypeScript Error in Main Process