Gatsby

To use Sentry with your Gatsby application, you will need to use @sentry/gatsby (Sentry’s Gatsby SDK):

Copied
npm install --save @sentry/gatsby

Register the @sentry/gatsby plugin in your Gatsby configuration file (typically gatsby-config.js).

gatsby-config.js
Copied
module.exports = {
  plugins: [
    {
      resolve: "@sentry/gatsby",
    },
  ],
};

Then, configure your Sentry.init:

sentry.config.js
Copied
import * as Sentry from "@sentry/gatsby";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",

  // Set tracesSampleRate to 1.0 to capture 100%
  // of transactions for performance monitoring.
  // We recommend adjusting this value in production
  tracesSampleRate: 1.0,
});
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").