Skip to content
This repository was archived by the owner on Apr 4, 2022. It is now read-only.

[Sentry] source-maps support #657

Merged
merged 3 commits into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ AUTOCONNECT=true

# Sentry
#REACT_APP_SENTRY_DSN='https://<url>'
#REACT_APP_SENTRY_TRACES_SAMPLE_RATE="1.0"
#REACT_APP_SENTRY_TRACES_SAMPLE_RATE="1.0"
#REACT_APP_SENTRY_AUTH_TOKEN='<sentry_auth_token>'
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
REPO_NAME_SLUG: gpui
PR_NUMBER: ${{ github.event.number }}
REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
REACT_APP_SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

jobs:
setup:
Expand Down
22 changes: 22 additions & 0 deletions getWebpackConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const assert = require('assert').strict
const path = require('path')
const { version } = require('./package.json')

const webpack = require('webpack')
const HtmlWebPackPlugin = require('html-webpack-plugin')
Expand All @@ -8,6 +9,7 @@ const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const PreloadWebpackPlugin = require('preload-webpack-plugin')
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const SentryWebpackPlugin = require('@sentry/webpack-plugin')
const markdownIt = require('markdown-it')
const linkAttributes = require('markdown-it-link-attributes')

Expand Down Expand Up @@ -111,6 +113,26 @@ function _getPlugins({ apps, config, envVars, stats, defineVars, publicPaths, is

// Production only plugins
if (isProduction) {
// Sentry source-maps plugin
const SENTRY_RELEASE = 'gp-explorer@v' + version
const SENTRY_AUTH_TOKEN = process.env.REACT_APP_SENTRY_AUTH_TOKEN

if (SENTRY_AUTH_TOKEN) {
plugins.push(
new SentryWebpackPlugin({
// sentry-cli configuration - can also be done directly through sentry-cli
// see https://docs.sentry.io/product/cli/configuration/ for details
authToken: SENTRY_AUTH_TOKEN,
org: 'gnosis-protocol',
project: 'gp-explorer',
release: SENTRY_RELEASE,
// other SentryWebpackPlugin configuration
include: './dist',
ignore: ['node_modules', 'webpack.config.js'],
}),
)
}

// Inline chunk html plugin: Inlines script chunks into index.html
plugins.push(new InlineChunkHtmlPlugin(HtmlWebPackPlugin, [/runtime/]))

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"@babel/register": "^7.8.3",
"@fortawesome/fontawesome-common-types": "^0.2.26",
"@hookform/devtools": "^2.2.1",
"@sentry/webpack-plugin": "^1.17.1",
"@storybook/addon-actions": "^6.2.9",
"@storybook/addon-essentials": "^6.2.9",
"@storybook/addon-knobs": "^6.2.9",
Expand Down
4 changes: 2 additions & 2 deletions src/apps/explorer/ExplorerApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const SENTRY_TRACES_SAMPLE_RATE = process.env.REACT_APP_SENTRY_TRACES_SAMPLE_RAT

if (SENTRY_DSN) {
Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
dsn: SENTRY_DSN,
integrations: [new Integrations.BrowserTracing()],
release: 'gp-explorer@' + version,
release: 'gp-explorer@v' + version,
environment: environmentName,

// Set tracesSampleRate to 1.0 to capture 100%
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const EXPLORER_APP = {
OPERATOR_URL_PROD_XDAI: 'https://protocol-xdai.gnosis.io/api',

GOOGLE_ANALYTICS_ID: undefined,
REACT_APP_SENTRY_DSN: undefined,
},
}
const SAFE_SWAP_APP = {
Expand Down
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,18 @@
"@sentry/utils" "6.12.0"
tslib "^1.9.3"

"@sentry/cli@^1.68.0":
version "1.68.0"
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.68.0.tgz#2ced8fac67ee01e746a45e8ee45a518d4526937e"
integrity sha512-zc7+cxKDqpHLREGJKRH6KwE8fZW8bnczg3OLibJ0czleXoWPdAuOK1Xm1BTMcOnaXfg3VKAh0rI7S1PTdj+SrQ==
dependencies:
https-proxy-agent "^5.0.0"
mkdirp "^0.5.5"
node-fetch "^2.6.0"
npmlog "^4.1.2"
progress "^2.0.3"
proxy-from-env "^1.1.0"

"@sentry/[email protected]":
version "6.12.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.12.0.tgz#bc7c5f0785b6a392d9ad47bd9b1fae3f5389996c"
Expand Down Expand Up @@ -2817,6 +2829,13 @@
"@sentry/types" "6.13.2"
tslib "^1.9.3"

"@sentry/webpack-plugin@^1.17.1":
version "1.17.1"
resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.17.1.tgz#1b3ebbe9991e4d77125ace2b24594059a088268a"
integrity sha512-L47a0hxano4a+9jbvQSBzHCT1Ph8fYAvGGUvFg8qc69yXS9si5lXRNIH/pavN6mqJjhQjAcEsEp+vxgvT4xZDQ==
dependencies:
"@sentry/cli" "^1.68.0"

"@sideway/address@^4.1.0":
version "4.1.2"
resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.2.tgz#811b84333a335739d3969cfc434736268170cad1"
Expand Down