Automatically upload source maps and notify Sentry of new releases being deployed to your site after it finishes building in Netlify.
The Sentry Netlify build plugin:
Before proceeding, you'll first want to ensure that your Sentry project is set up properly to track commit metadata. The easiest way to do that is to install a repository integration.
Make sure build plugins are enabled on your site to see the plugin run.
To install plugins via the Netlify UI, go to your team sites list and select the Plugins tab (or follow this direct link to the plugins directory). Then find "Sentry Build Plugin" and click Install.
UI installation is the recommended way to install this Build Plugin unless you need advanced configuration.
Alternatively, to install with file-based installation, add the following lines to your
[[plugins]] package = "@sentry/netlify-build-plugin" [plugins.inputs] sentryOrg = "" sentryProject = ""
[[plugins]] line is required for each plugin installed via file-based installation, even if you have other plugins in your
netlify.toml file already.
For Netlify to communicate securely with Sentry, you'll need to create a new internal integration. In Sentry, navigate to: Settings > Developer Settings > New Internal Integration.
Give your new integration a name (for example, “Netlify Deploy Integration”) and specify the necessary permissions. In this case, we need Admin access for “Release” and Read access for “Organization”.
Click “Save” at the bottom of the page and grab your token, which you’ll need this in the next step.
Save the internal integration token and any other environment variables as site environment variables:
SENTRY_PROJECTwith their respective values. For more configuration options see the environment variables section below.
For more information about the parameters below, please see the Sentry release management docs.
To link errors with releases, you must include a release ID (a.k.a version) where you configure your client SDK. For more information, read our documentation on configuring your SDK for releases.
You can use site environment variables to configure these values:
| name | description | default |
SENTRY_AUTH_TOKEN | Authentication token for Sentry. | - |
SENTRY_ORG | The slug of the organization name in Sentry. | - |
SENTRY_PROJECT | The slug of the project name in Sentry. | - |
SENTRY_RELEASE | The release ID (a.k.a version). | COMMIT_REF |
SENTRY_ENVIRONMENT | The name of the environment being deployed to. | Netlify deploy context |
SENTRY_RELEASE_PREFIX | Set this to prefix the release name with the value. | - |
|The slug of the organization name in Sentry.||-|
|The slug of the project name in Sentry.||-|
|Authentication token for Sentry. We recommend this be set as an environment variable (see below).||-|
|The release ID (a.k.a version).||COMMIT_REF|
|Folder in which to scan for source maps to upload.||Netlify publish directory|
|Prefix for the location of source maps.|
|Set this to true if you want to disable commit tracking.|
|Set this to true if you want to disable sending source maps to Sentry.|
|Set this to prefix the release name with the value.||-|
|Set this to false if you want to skip running the build plugin on deploy previews.|