From f7b4f9323a62ed0f5d5b489ef007bce85606ccee Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 7 Feb 2023 17:14:43 +0100 Subject: [PATCH] fix(gatsby): Remove plugin configuration docs We want users to only use the `sentry.config.ts` method, not the plugin options method, so remove it from the docs. Version 7 has been out long enough that this should be safe to do. --- .../javascript/guides/gatsby/index.mdx | 49 +------------------ 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/src/platforms/javascript/guides/gatsby/index.mdx b/src/platforms/javascript/guides/gatsby/index.mdx index deb783e799ab8..1d1b6f0153717 100644 --- a/src/platforms/javascript/guides/gatsby/index.mdx +++ b/src/platforms/javascript/guides/gatsby/index.mdx @@ -22,19 +22,7 @@ yarn add @sentry/gatsby -## Connecting the SDK to Sentry - -You can configure the SDK in one of two ways discussed below: by creating a configuration file, or defining the options along with the Gatsby configuration. If you define options in both places, the SDK will prioritize the `init` in the configuration file and ignore the options in the Gatsby configuration. - -### Sentry Configuration File - - - -The minimum version supporting the Sentry configuration file is `6.14.0`. - - - -Using a Sentry configuration file is the approach we recommend since it supports defining non-serializable options in the `init`. Note that you still need to include the plugin, even if you don't set any options. +First add `@sentry/gatsby` as a plugin to your `gatsby-config.js`. ```javascript {filename:gatsby-config.js} module.exports = { @@ -46,7 +34,7 @@ module.exports = { }; ``` -Configure your `Sentry.init`: +Then, configure your `Sentry.init`: ```javascript {filename:sentry.config.js} import * as Sentry from "@sentry/gatsby"; @@ -83,36 +71,3 @@ Sentry.init({ // ... }); ``` - -### Gatsby Plugin Configuration - -Another alternative is to use Gatsby's [plugin configuration options](https://www.gatsbyjs.com/docs/how-to/plugins-and-themes/using-a-plugin-in-your-site/#using-plugin-configuration-options). While this keeps the SDK options with the plugin definition, it doesn't support non-serializable options like `integrations`, `transport`, `stackParser`,`beforeSend`, `beforeSendTransaction`, and `tracesSampler`. - -```javascript {filename:gatsby-config.js} -module.exports = { - plugins: [ - { - resolve: "@sentry/gatsby", - options: { - dsn: "___PUBLIC_DSN___", - tracesSampleRate: 1.0, // Adjust this value in production - // Cannot set any non-serializable options - }, - }, - ], -}; -``` - -With this approach, the SDK sets some options automatically based on environmental variables, but these can be overridden by setting custom options. - -`environment` (string) - -: Defaults to `process.env.NODE_ENV` or `development` - -`release` (string) - -: Defaults to certain environment variables based on the platform - -- GitHub Actions: `process.env.GITHUB_SHA` -- Netlify: `process.env.COMMIT_REF` -- Vercel: `process.env.VERCEL_GIT_COMMIT_SHA`