Skip to content

Commit

Permalink
feat: upgrade Sentry SDK (#254)
Browse files Browse the repository at this point in the history
* feat: uninstall raven-js

* feat: install new sentry packages

* feat: import and init new sentry module

* docs: replace Raven with Sentry
  • Loading branch information
mantariksh authored Sep 2, 2020
1 parent 7a81f71 commit f67732c
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/DEPLOYMENT_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ If this feature is enabled, client-side error events will be piped to [sentry.io

| Variable | Description |
| :------------------ | ----------------------------------------------------------------------------------------------------- |
| `SENTRY_CONFIG_URL` | Sentry.io URL for configuring the Raven SDK. |
| `SENTRY_CONFIG_URL` | Sentry.io URL for configuring the Sentry SDK. |
| `CSP_REPORT_URI` | Reporting URL for Content Security Policy violdations. Can be configured to use a Sentry.io endpoint. |

#### Examples page Using Pre-Computed Results
Expand Down
94 changes: 87 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
"@opengovsg/myinfo-gov-client": "^1.0.4",
"@opengovsg/ng-file-upload": "^12.2.14",
"@opengovsg/spcp-auth-client": "^1.3.0",
"@sentry/browser": "^5.22.3",
"@sentry/integrations": "^5.22.3",
"@stablelib/base64": "^1.0.0",
"JSONStream": "^1.3.5",
"angular": "~1.8.0",
Expand Down Expand Up @@ -142,7 +144,6 @@
"promise-retry": "^2.0.1",
"proxyquire": "^2.1.0",
"puppeteer-core": "^5.2.1",
"raven-js": "^3.27.0",
"rimraf": "^3.0.2",
"selectize": "0.12.4",
"slick-carousel": "1.8.1",
Expand Down
2 changes: 1 addition & 1 deletion src/config/feature-manager/sentry.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const sentryFeature: RegisterableFeature<FeatureNames.Sentry> = {
name: FeatureNames.Sentry,
schema: {
sentryConfigUrl: {
doc: 'Sentry.io URL for configuring the Raven SDK',
doc: 'Sentry.io URL for configuring the Sentry SDK',
format: 'url',
default: null,
env: 'SENTRY_CONFIG_URL',
Expand Down
15 changes: 9 additions & 6 deletions src/public/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict'

const textEncoding = require('text-encoding')
const Sentry = require('@sentry/browser')
const { Angular: AngularIntegration } = require('@sentry/integrations')

if (!window['TextDecoder']) {
window['TextDecoder'] = textEncoding.TextDecoder
Expand All @@ -10,7 +12,7 @@ if (!window['TextEncoder']) {
window['TextEncoder'] = textEncoding.TextEncoder
}

// Define module dependencies (without ngRaven)
// Define module dependencies (without ngSentry)
const moduleDependencies = [
'ui.select',
'ngAnimate',
Expand Down Expand Up @@ -41,12 +43,13 @@ window.$ = window.jQuery
const angular = require('angular')

// Sentry.io SDK
const Raven = require('raven-js')
// Docs: https://docs.sentry.io/platforms/javascript/guides/angular/angular1/
if (window.sentryConfigUrl) {
Raven.config(window.sentryConfigUrl)
.addPlugin(require('raven-js/plugins/angular'), angular)
.install()
moduleDependencies.push('ngRaven')
Sentry.init({
dsn: window.sentryConfigUrl,
integrations: [new AngularIntegration()],
})
moduleDependencies.push('ngSentry')
}

require('angular-translate')
Expand Down

0 comments on commit f67732c

Please sign in to comment.