Socket
Socket
Sign inDemoInstall

@bugsnag/js

Package Overview
Dependencies
2
Maintainers
9
Versions
136
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bugsnag/js


Version published
Maintainers
9
Created

Package description

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

Changelog

Source

[7.25.0] - 2024-07-03

Added

  • (core) Add new setTraceCorrelation method to events #2159

Changed

  • (react-native) Update bugsnag-cocoa from v6.28.1 to v6.29.0
  • (react-native) Update bugsnag-android from v5.32.2 to v5.32.3

Fixed

  • (react-native) Use synchronous native module calls when New Architecture is enabled #2152
  • (react-native) Ensure client is initialised synchronously in bridgeless mode #2165

Readme

Source

@bugsnag/js

Universal JavaScript notifier.

This package contains both @bugsnag/browser and @bugsnag/node and the appropriate one will be included in your application.

Node.js

In Node, importing '@bugsnag/js' will provide the @bugsnag/node module.

Browser

In various bundlers, importing '@bugsnag/js' will provide the @bugsnag/browser module.

BundlerSupport
BrowserifySupports the package.json "browser" field by default
WebpackSupports the package.json "browser" field by default
RollupSet browser: true in the node-resolve plugin

Note: by using this browser-specific entrypoint, none of the node-specific code will be included in your bundle.

License

This package is free software released under the MIT License. See LICENSE.txt for details.

Keywords

FAQs

Last updated on 03 Jul 2024

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc