Node.js Node.js logo for BugSplat

7 minute read

BugSplat’s JavaScript integration works with any application that supports npm including Node.js, and Electron applications.



To add the bugsplat package to your application, run the following shell command at the root of your project’s directory:

npm install --save bugsplat

Require the bugsplat module at the entry point of your application. Provide the name of your BugSplat database, the name of your application and the version of your application:

const bugsplat = require("bugsplat")("DatabaseName", "ApplicationName", "");

Set the function as an event handler for uncaught exceptions:


If your application uses promises you will also want to listen for unhandled promise rejections. Please note that this will only work for native promises:


Throw an exception after the event handler has been added.

throw new Error("BugSplat!");

Navigate to the Crashes page in BugSplat and you should see a new crash report for the application you just configured. Click the link in the Id column to see details about your crash on the Individual Crash page:

Integrating Node.js with BugSplat Integrating Node.js with BugSplat

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


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

bugsplat.setAppKey (appKey) ; // A unique identifier for your application
bugsplat.setUser(user); // The name or id of your user
bugsplat.setEmail(email); // The email of your user 
bugsplat.setDescription(description); // Additional info about your crash that gets reset after every post
bugsplat.addAdditionalFile(pathToFile); // Path to a file to be added at post time (limit 1MB) 
bugsplat.setCallback(callback); // Function that accepts 2 parameters (err, responseBody) that runs after post; // Post an arbitrary Error object to BugSplat