Skip to content

Commit 60c3a8c

Browse files
authored
Fix Sentry by making it optional with an exported default config (#79)
* Make sentry optional, with an exported default config * Remove incomplete sentry integration from example * Add yarn.lock * Add sentry to example
1 parent 9fe4537 commit 60c3a8c

File tree

7 files changed

+66
-62
lines changed

7 files changed

+66
-62
lines changed

packages/example/gatsby-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = {
2424
name: 'images',
2525
path: path.join(__dirname, 'static', 'img')
2626
}
27-
}
27+
},
28+
'@sentry/gatsby'
2829
]
2930
}

packages/example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@dvcorg/gatsby-theme-iterative": "*",
15+
"@sentry/gatsby": "^7.13.0",
1516
"gatsby": "^4.14.1",
1617
"gatsby-transformer-remark": "^5.14.0",
1718
"react": "^18.0.0",

packages/example/sentry.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as Sentry from '@sentry/gatsby'
2+
import sentryConfig from '@dvcorg/gatsby-theme-iterative/sentry-config'
3+
4+
Sentry.init(sentryConfig)

packages/gatsby-theme-iterative/gatsby-config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ module.exports = ({
168168
placeholder: 'blurred'
169169
}
170170
}
171-
},
172-
'@sentry/gatsby'
171+
}
173172
],
174173
siteMetadata: {
175174
author: 'Iterative',

packages/gatsby-theme-iterative/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"@reach/portal": "^0.17.0",
1111
"@reach/router": "^1.3.4",
1212
"@reach/skip-nav": "^0.17.0",
13-
"@sentry/gatsby": "^7.12.1",
1413
"@svgr/webpack": "^6.2.1",
1514
"@types/github-slugger": "^1.3.0",
1615
"@types/isomorphic-fetch": "^0.0.36",

packages/gatsby-theme-iterative/sentry.config.js renamed to packages/gatsby-theme-iterative/sentry-config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import * as Sentry from '@gatsby/sentry'
2-
3-
Sentry.init({
1+
/* This is the default Sentry config for all Iterative websites.
2+
* Much of this is lifted from Sentry's docs
3+
* see https://docs.sentry.io/platforms/javascript/guides/gatsby/configuration/filtering/#decluttering-sentry
4+
*/
5+
export default {
46
dsn: process.env.SENTRY_DSN,
57
environment: process.env.NODE_ENV,
68
release: process.env.SOURCE_VERSION,
@@ -13,7 +15,6 @@ Sentry.init({
1315
page from the new deployed version and all will be ok. So we can just
1416
ignore these type of errors */
1517
'ChunkLoadError',
16-
// from https://docs.sentry.io/platforms/javascript/guides/gatsby/configuration/filtering/#decluttering-sentry
1718
// Random plugins/extensions
1819
'top.GLOBALS',
1920
// See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
@@ -36,7 +37,6 @@ Sentry.init({
3637
// See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
3738
'conduitPage'
3839
],
39-
// from https://docs.sentry.io/platforms/javascript/guides/gatsby/configuration/filtering/#decluttering-sentry
4040
denyUrls: [
4141
// Facebook flakiness
4242
/graph\.facebook\.com/i,
@@ -53,4 +53,4 @@ Sentry.init({
5353
/webappstoolbarba\.texthelp\.com\//i,
5454
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i
5555
]
56-
})
56+
}

yarn.lock

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,14 +2376,14 @@
23762376
tiny-warning "^1.0.3"
23772377
tslib "^2.3.0"
23782378

2379-
"@sentry/browser@7.12.1":
2380-
version "7.12.1"
2381-
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.12.1.tgz#2be6fa5c2529a2a75abac4d00aca786362302a1a"
2382-
integrity sha512-pgyL65CrGFLe8sKcEG8KXAuVTE8zkAsyTlv/AuME06cSdxzO/memPK/r3BI6EM7WupIdga+V5tQUldeT1kgHNA==
2383-
dependencies:
2384-
"@sentry/core" "7.12.1"
2385-
"@sentry/types" "7.12.1"
2386-
"@sentry/utils" "7.12.1"
2379+
"@sentry/browser@7.13.0":
2380+
version "7.13.0"
2381+
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.13.0.tgz#883b8598c8a0c33af246242e7172e39306dc564a"
2382+
integrity sha512-WbgClHPYe8TKsdVVbuzd6alxwh3maFQNuljMkSTnYvPx2P+NT0wHljTs37D39FGfSmAwaqn7D/1ZHAtC+6mWxA==
2383+
dependencies:
2384+
"@sentry/core" "7.13.0"
2385+
"@sentry/types" "7.13.0"
2386+
"@sentry/utils" "7.13.0"
23872387
tslib "^1.9.3"
23882388

23892389
"@sentry/cli@^1.74.4":
@@ -2399,68 +2399,68 @@
23992399
proxy-from-env "^1.1.0"
24002400
which "^2.0.2"
24012401

2402-
"@sentry/core@7.12.1":
2403-
version "7.12.1"
2404-
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.12.1.tgz#a22f1c530ed528a699ed204c36eb5fc8d308103d"
2405-
integrity sha512-DFHbzHFjukhlkRZ5xzfebx0IBzblW43kmfnalBBq7xEMscUvnhsYnlvL9Y20tuPZ/PrTcq4JAHbFluAvw6M0QQ==
2402+
"@sentry/core@7.13.0":
2403+
version "7.13.0"
2404+
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.13.0.tgz#65597d71f8bfa1186f34009803e03ca9edb3adee"
2405+
integrity sha512-hB46fklmKrSDMEvZOF8qBHhys7PONBFyxQtbNDZUlv/kabs4gF3VEg1ftCaXnjx4lLNlsUl/ScFdM6194RvISg==
24062406
dependencies:
2407-
"@sentry/hub" "7.12.1"
2408-
"@sentry/types" "7.12.1"
2409-
"@sentry/utils" "7.12.1"
2407+
"@sentry/hub" "7.13.0"
2408+
"@sentry/types" "7.13.0"
2409+
"@sentry/utils" "7.13.0"
24102410
tslib "^1.9.3"
24112411

2412-
"@sentry/gatsby@^7.12.1":
2413-
version "7.12.1"
2414-
resolved "https://registry.yarnpkg.com/@sentry/gatsby/-/gatsby-7.12.1.tgz#ebb7e7b400a481c479a35295e80946d44960eb9c"
2415-
integrity sha512-fCDl3FU06P2TItqq2ps+QQi71b9CPY3Zcj/oPmaVH9M+mc3ze40UypgyT2kUoUliN727f9Yp08RmgG3xn9d46A==
2412+
"@sentry/gatsby@^7.13.0":
2413+
version "7.13.0"
2414+
resolved "https://registry.yarnpkg.com/@sentry/gatsby/-/gatsby-7.13.0.tgz#50965623d43dc437704660a6cbef8ac2927043fc"
2415+
integrity sha512-kHaO4dl5dfqUyw7dxdvRo4FRKqOPMW6R26zokmlsYNKDPcHlYZXOpHZpCgJgTKV6ZuKdyfh6RRur2d/yIzvaNg==
24162416
dependencies:
2417-
"@sentry/react" "7.12.1"
2418-
"@sentry/tracing" "7.12.1"
2419-
"@sentry/types" "7.12.1"
2420-
"@sentry/utils" "7.12.1"
2417+
"@sentry/react" "7.13.0"
2418+
"@sentry/tracing" "7.13.0"
2419+
"@sentry/types" "7.13.0"
2420+
"@sentry/utils" "7.13.0"
24212421
"@sentry/webpack-plugin" "1.19.0"
24222422

2423-
"@sentry/hub@7.12.1":
2424-
version "7.12.1"
2425-
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-7.12.1.tgz#dffad40cd2b8f44df2d5f20a89df87879cbbf1c3"
2426-
integrity sha512-KLVnVqXf+CRmXNy9/T8K2/js7QvOQ94xtgP5KnWJbu2rl+JhxnIGiBRF51lPXFIatt7zWwB9qNdMS8lVsvLMGQ==
2423+
"@sentry/hub@7.13.0":
2424+
version "7.13.0"
2425+
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-7.13.0.tgz#752068e528cfb277ed154bc94e311cad50ef792e"
2426+
integrity sha512-88/GsD1BoyrBwRKJCmVHZtSH5rizOsImUHWEXc1AOa1aR8nanfn56JdAbd6tC55pA+nT4R4H4vN/PrUaomTbtg==
24272427
dependencies:
2428-
"@sentry/types" "7.12.1"
2429-
"@sentry/utils" "7.12.1"
2428+
"@sentry/types" "7.13.0"
2429+
"@sentry/utils" "7.13.0"
24302430
tslib "^1.9.3"
24312431

2432-
"@sentry/react@7.12.1":
2433-
version "7.12.1"
2434-
resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.12.1.tgz#075162d39ea05c58217597d5242f7046c3152ea9"
2435-
integrity sha512-CmdiRzhPpjD29GxlDJs+VIoLlQcKp1BfISQOfPUZNppWbKyRad+J5Z8tgg5MCNPHjQtcOT+0V+MsSdRNqtXg4g==
2432+
"@sentry/react@7.13.0":
2433+
version "7.13.0"
2434+
resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.13.0.tgz#64fa5a2b944c977f75626c6208afa3478c13714c"
2435+
integrity sha512-ulvBmMiwt+4RXwnDkP9qNr7rMJIFE4QXuNxho5pIqWEU9q2656CoL5kau9f2TQQEBxNc9dR4QmUdGyzuEaYPIQ==
24362436
dependencies:
2437-
"@sentry/browser" "7.12.1"
2438-
"@sentry/types" "7.12.1"
2439-
"@sentry/utils" "7.12.1"
2437+
"@sentry/browser" "7.13.0"
2438+
"@sentry/types" "7.13.0"
2439+
"@sentry/utils" "7.13.0"
24402440
hoist-non-react-statics "^3.3.2"
24412441
tslib "^1.9.3"
24422442

2443-
"@sentry/tracing@7.12.1":
2444-
version "7.12.1"
2445-
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.12.1.tgz#9f92985f152054ac90b6ec83a33c44e8084a008e"
2446-
integrity sha512-WnweIt//IqkEkJSjA8DtnIeCdItYIqJSxNQ6qK+r546/ufxRYFBck2fbmM0oKZJVg2evbwhadrBTIUzYkqNj4A==
2443+
"@sentry/tracing@7.13.0":
2444+
version "7.13.0"
2445+
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.13.0.tgz#521dc021dab78e37e29b0f90b01cb444337adfc4"
2446+
integrity sha512-/MKSd25rGv6Pc0FPBLXJifkfvSaYVPA8XUOLzVeDN0gl07h8AXli4qG9amTh/4Wb5h4dFpbcscOvW2VC+pxkIA==
24472447
dependencies:
2448-
"@sentry/hub" "7.12.1"
2449-
"@sentry/types" "7.12.1"
2450-
"@sentry/utils" "7.12.1"
2448+
"@sentry/hub" "7.13.0"
2449+
"@sentry/types" "7.13.0"
2450+
"@sentry/utils" "7.13.0"
24512451
tslib "^1.9.3"
24522452

2453-
"@sentry/types@7.12.1":
2454-
version "7.12.1"
2455-
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.12.1.tgz#eff76d938f9effc62a2ec76cd5c3f04de37f5c15"
2456-
integrity sha512-VGZs39SZgMcCGv7H0VyFy1LEFGsnFZH590JUopmz6nG63EpeYQ2xzhIoPNAiLKbyUvBEwukn+faCg3u3MGqhgQ==
2453+
"@sentry/types@7.13.0":
2454+
version "7.13.0"
2455+
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.13.0.tgz#398e33e5c92ea0ce91e2c86e3ab003fe00c471a2"
2456+
integrity sha512-ttckM1XaeyHRLMdr79wmGA5PFbTGx2jio9DCD/mkEpSfk6OGfqfC7gpwy7BNstDH/VKyQj/lDCJPnwvWqARMoQ==
24572457

2458-
"@sentry/utils@7.12.1":
2459-
version "7.12.1"
2460-
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.12.1.tgz#fcf80fdc332d0bd288e21b13efc7a2f0d604f75a"
2461-
integrity sha512-Dh8B13pC0u8uLM/zf+oZngyg808c6BDEO94F7H+h3IciCVVd92A0cOQwLGAEdf8srnJgpZJNAlSC8lFDhbFHzQ==
2458+
"@sentry/utils@7.13.0":
2459+
version "7.13.0"
2460+
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.13.0.tgz#0d47a9278806ece78ba3a83c7dbebce817462759"
2461+
integrity sha512-jnR85LgRLSk7IQe2OhKOPMY4fasJCNQNW0iCXsH+S2R1qnsF+N4ksNkQ+7JyyM9E7F03YpI2qd76bKY0VIn5iA==
24622462
dependencies:
2463-
"@sentry/types" "7.12.1"
2463+
"@sentry/types" "7.13.0"
24642464
tslib "^1.9.3"
24652465

24662466
"@sentry/webpack-plugin@1.19.0":

0 commit comments

Comments
 (0)