How to use the @bugsnag/js function in @bugsnag/js

To help you get started, we’ve selected a few @bugsnag/js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maciejtreder / ng-toolkit / schematics / firebug / src / index.ts View on Github external
import { Rule, chain, mergeWith, MergeStrategy, apply, url, move, Tree, SchematicContext } from '@angular-devkit/schematics';
import { applyAndLog, createOrOverwriteFile, addOrReplaceScriptInPackageJson, addEntryToEnvironment, updateBoostrapFirebug, addDependencyToPackageJson } from '@ng-toolkit/_utils';
import { getFileContent } from '@schematics/angular/utility/test';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
import { Path } from '../node_modules/@angular-devkit/core';
import { getWorkspace } from '@schematics/angular/utility/config';
import { NodeDependencyType } from '@schematics/angular/utility/dependencies';
import { IFirebugSchema } from './schema';
import bugsnag from '@bugsnag/js';

const bugsnagClient = bugsnag('0b326fddc255310e516875c9874fed91');

export default function addFirebug(options: IFirebugSchema): Rule {
    if (!options.clientProject) {
        options.clientProject = options.project;
    }
    
    // Register bugsnag in order to catch and notify any rule error.
    bugsnagClient.config.beforeSend = (report: any) => {
        report.metaData = {
            subsystem: {
                package: 'firebug',
                options: options
            }
        }
    }
github bugsnag / bugsnag-js / examples / react / src / lib / bugsnag.js View on Github external
// This file instantiates one Bugsnag client for the entire application

// Components and modules that want to send handled errors can import the
// exported client to send handled errors

// Components can get access to the React <ErrorBoundary/> by calling
//
//    const ErrorBoundary = bugsnagClient.getPlugin('react')
//

import bugsnag from '@bugsnag/js'
import bugsnagReact from '@bugsnag/plugin-react'
import React from 'react'

const bugsnagClient = bugsnag('YOUR_API_KEY')
  .use(bugsnagReact, React)

export default bugsnagClient
github maciejtreder / ng-toolkit / schematics / serverless / src / index.ts View on Github external
import { apply, chain, mergeWith, move, Rule, Tree, url, MergeStrategy, SchematicContext, Source } from '@angular-devkit/schematics';
import {
    applyAndLog, addOrReplaceScriptInPackageJson, addOpenCollective, updateGitIgnore, addDependencyInjection,
    createOrOverwriteFile, addEntryToEnvironment, getMethodBody, updateMethod, addMethod, addImportStatement, getDistFolder,
    isUniversal, getBrowserDistFolder, getServerDistFolder, implementInterface, getNgToolkitInfo, updateNgToolkitInfo, addDependencyToPackageJson
} from '@ng-toolkit/_utils';
import { getFileContent } from '@schematics/angular/utility/test';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
import { Path } from '@angular-devkit/core';
import { NodeDependencyType } from '@schematics/angular/utility/dependencies';
import { IServerlessSchema } from './schema';
import outdent from 'outdent';
import bugsnag from '@bugsnag/js';

const bugsnagClient = bugsnag('0b326fddc255310e516875c9874fed91');

export default function addServerless(options: IServerlessSchema): Rule {
    if (!options.clientProject) {
        options.clientProject = options.project;
    }
    // Register bugsnag in order to catch and notify any rule error.
    bugsnagClient.config.beforeSend = (report) => {
        report.metaData = {
            subsystem: {
                package: 'serverless',
                options: options
            }
        }
    }

    // Initialize Serverless property with empty object values.
github 5calls / 5calls / src / services / bugsnag.ts View on Github external
import * as React from 'react';
import bugsnag from '@bugsnag/js';
import bugsnagReact from '@bugsnag/plugin-react';

let bugsnagClient;
// hi this is really bad but I can't figure out how to mock this everywhere otherwise
if (process.env.JEST_WORKER_ID) {
  bugsnagClient = {};
} else {
  bugsnagClient = bugsnag({
    apiKey: '67e3931dbe1bbf48991ce7d682ceb676',
    notifyReleaseStages: ['production']
  });
  bugsnagClient.use(bugsnagReact, React);
}

export default bugsnagClient;
github replicatedhq / kots / web / src / index.jsx View on Github external
import * as React from "react";
import * as ReactDOM from "react-dom";
import bugsnag from "@bugsnag/js"
import bugsnagReact from "@bugsnag/plugin-react"
import ReplicatedErrorBoundary from "./components/shared/ErrorBoundary";
import Root from "./Root";

if (window.env.BUGSNAG_API_KEY && window.env.ENVIRONMENT !== "development") {
  const bugsnagClient = bugsnag({
    apiKey: window.env.BUGSNAG_API_KEY,
    releaseStage: window.env.ENVIRONMENT,
    appVersion: window.env.SHIP_CLUSTER_BUILD_VERSION
  });
  bugsnagClient.use(bugsnagReact, React);

  const ErrorBoundary = bugsnagClient.getPlugin("react");
  ReactDOM.render((
    <ErrorBoundary FallbackComponent={ReplicatedErrorBoundary}>
      <Root />
    </ErrorBoundary>
  ), document.getElementById("app"));
} else {
  ReactDOM.render((
    <ReplicatedErrorBoundary>
      <Root />
github replicatedhq / kots / kotsadm / api / src / server / bugsnagClient.ts View on Github external
export function createBugsnagClient(bugsnagOptions: BugsnagCore.IConfig): BugsnagCore.Client | void {
  if (bugsnagOptions.apiKey) {
    bugsnagClient = bugsnag({
      ...bugsnagOptions
    });
  }

  return bugsnagClient;
}
github bugsnag / bugsnag-sourcemaps / example / typescript / src / services / bugsnag.ts View on Github external
import bugsnag from '@bugsnag/js'
const bugsnagClient = bugsnag({
  apiKey: 'YOUR_API_KEY',
  appVersion: require('../../package.json').version
})
export default bugsnagClient
github hackoregon / openelections / api / app.ts View on Github external
(async () => {
    await db();
    const app: express.Express = express();

    if (process.env.NODE_ENV === 'production') {
        const bugsnagClient = bugsnag(process.env.BUG_SNAG_API_KEY);
        bugsnagClient.use(bugsnagExpress);
        const middleware = bugsnagClient.getPlugin('express');
        app.use(middleware.requestHandler);
        app.use(middleware.errorHandler);
    }
    app.use(logger('dev'));
    app.use(fileUpload({
        createParentPath: true,
        limits: {
            fileSize: 10 * 1024 * 1024 * 1024 //10MB max file(s) size
        },
        useTempFiles : true,
        tempFileDir : '/app/uploads',
        debug: true
    }));
    app.use(cors(corsOptions));
github toggl / toggl-button / src / scripts / lib / bugsnag.ts View on Github external
function getBugsnagClient () {
  if (!process.env.BUGSNAG_API_KEY) {
    return {
      leaveBreadcrumb: noop('leaveBreadcrumb'),
      notify: noop('notify')
    };
  }

  const bugsnagClient = bugsnag({
    apiKey: process.env.BUGSNAG_API_KEY,
    appVersion: process.env.VERSION,
    releaseStage: process.env.NODE_ENV,
    notifyReleaseStages: ['production', 'development'],
    autoBreadcrumbs: false,
    autoCaptureSessions: false,
    collectUserIp: false,
    beforeSend: async function (report) {
      const db = browser.extension.getBackgroundPage().db;
      const sendErrorReports = await db.get('sendErrorReports');
      if (!sendErrorReports) {
        report.ignore();
      }

      report.stacktrace = report.stacktrace.map(function (frame) {
        frame.file = frame.file.replace(/chrome-extension:/g, 'chrome_extension:');

@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.

MIT
Latest version published 2 days ago

Package Health Score

89 / 100
Full package analysis