@atlassian/sentry-transport-forge
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Forge transport for Sentry

Custom transport for Sentry. Use it to send captured errors and messages from Forge runtime.

Usage

import { ForgeRuntimeTransport, ForgeRuntimeTransportOptions } from '@atlassian/sentry-transport-forge';
import { fetch } from '@forge/api';
import * as Sentry from '@sentry/node';

const DISABLE_INTEGRATIONS = [
    Sentry.Integrations.Http,
    Sentry.Integrations.OnUncaughtException,
    Sentry.Integrations.OnUnhandledRejection,
];
Sentry.init({
    dsn: process.env.SENTRY_DSN,
    // version 6.9.0 enables `autoSessionTracking` by default
    // `autoSessionTracking` uses `process.on('beforeExit')` which is not available in Forge runtime
    transport: ForgeRuntimeTransport,
    transportOptions: {
        dsn: process.env.SENTRY_DSN,
        fetch,
        logError: console.error,
    } as ForgeRuntimeTransportOptions,
    autoSessionTracking: false,
    // some integrations don't work well in Forge runtime
    // as they rely on Node.JS environment
    integrations: integrations => {
        return integrations.filter(integration => {
            return DISABLE_INTEGRATIONS.every(DisableIntegrationConstructor => {
                return !(integration instanceof DisableIntegrationConstructor);
            });
        });
    },
    ...restOptions,
});

Support

See Get help for how to get help and provide feedback.

Readme

Keywords

Package Sidebar

Install

npm i @atlassian/sentry-transport-forge

Weekly Downloads

54

Version

0.3.0

License

Apache-2.0

Unpacked Size

16.6 kB

Total Files

15

Last publish

Collaborators

  • atlassianartifactteam
  • decompil3d
  • rafalsatl
  • kbielaski
  • dwalker
  • atlassian-aui
  • mdejongh
  • mszczepanski
  • cdarroch
  • dboyd
  • dmorrow
  • mstaas
  • cwhittington
  • 1999-atlassian
  • wyasvoin
  • xqiu
  • gleal-atlassian
  • mszpyra
  • bcytrowski
  • tilwin_atlassian
  • mrzymski
  • media-build-bot
  • akishore
  • timse
  • mkem114
  • tsebastian
  • sfp-release-bot