Socket
Socket
Sign inDemoInstall

@bugsnag/js

Package Overview
Dependencies
Maintainers
9
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bugsnag/js

Universal Javascript error reporting. Automatically detect JavaScript errors in the browser and Node.js, with plugins for React, Vue, Angular, Express, Restify and Koa.


Version published
Weekly downloads
565K
decreased by-13.47%
Maintainers
9
Weekly downloads
 
Created

What is @bugsnag/js?

@bugsnag/js is a JavaScript error monitoring and reporting tool that helps developers detect, diagnose, and resolve errors in their applications. It provides real-time error tracking, detailed error reports, and integrations with various platforms and frameworks.

What are @bugsnag/js's main functionalities?

Error Reporting

This feature allows you to report errors to Bugsnag. The code sample initializes Bugsnag with an API key and reports a test error.

const Bugsnag = require('@bugsnag/js');
Bugsnag.start({ apiKey: 'YOUR_API_KEY' });

try {
  throw new Error('Test error');
} catch (e) {
  Bugsnag.notify(e);
}

Breadcrumbs

Breadcrumbs are logs of user actions or application events that lead up to an error. This code sample shows how to leave a breadcrumb when a user clicks a button.

const Bugsnag = require('@bugsnag/js');
Bugsnag.start({ apiKey: 'YOUR_API_KEY' });

Bugsnag.leaveBreadcrumb('User clicked button', { buttonId: 'submit' });

Custom Metadata

You can add custom metadata to error reports for more context. This code sample demonstrates adding account information to an error report.

const Bugsnag = require('@bugsnag/js');
Bugsnag.start({ apiKey: 'YOUR_API_KEY' });

Bugsnag.notify(new Error('Test error'), event => {
  event.addMetadata('account', {
    id: 123,
    name: 'Acme Co'
  });
});

Session Tracking

Session tracking helps you understand the stability of your application by tracking user sessions. This code sample shows how to start a session.

const Bugsnag = require('@bugsnag/js');
Bugsnag.start({ apiKey: 'YOUR_API_KEY' });

Bugsnag.startSession();

Other packages similar to @bugsnag/js

Keywords

FAQs

Package last updated on 25 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc