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

8.7.0 • Public • Published

Sentry

Official Sentry SDK for GatsbyJS

First register the package as a plugin in gatsby-config.js:

module.exports = {
  // ...
  plugins: [
    {
      resolve: '@sentry/gatsby',
      options: {
        dsn: process.env.SENTRY_DSN, // this is the default
      },
    },
    // ...
  ],
};

Then configure your Sentry.init call:

import * as Sentry from '@sentry/gatsby';

Sentry.init({
  dsn: '__PUBLIC_DSN__',
  integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],

  // Set tracesSampleRate to 1.0 to capture 100%
  // of transactions for performance monitoring.
  // We recommend adjusting this value in production
  tracesSampleRate: 1.0,

  // Capture Replay for 10% of all sessions,
  // plus for 100% of sessions with an error
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,

  // Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
  tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
});

The Gatsby SDK also automatically sets up sourcemaps uploading for you. To disable this functionality, set the enableClientWebpackPlugin option to be false.

module.exports = {
  // ...
  plugins: [
    {
      resolve: '@sentry/gatsby',
      options: {
        enableClientWebpackPlugin: false,
      },
    },
    // ...
  ],
};

Links

Readme

Keywords

Package Sidebar

Install

npm i @sentry/gatsby

Weekly Downloads

26,056

Version

8.7.0

License

MIT

Unpacked Size

12.3 kB

Total Files

23

Last publish

Collaborators

  • benvinegar
  • billyvg
  • mitsuhiko
  • haza
  • jauer
  • sentry-bot
  • evanpurkhiser
  • lynnagara
  • leedongwei
  • markstory
  • zeeg