Skip to content

Commit

Permalink
Revert "Revert "Add sentry""
Browse files Browse the repository at this point in the history
This reverts commit c21785f.
  • Loading branch information
iAdramelk committed Feb 10, 2020
1 parent d05f585 commit de1857b
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 1 deletion.
14 changes: 14 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint-env node */

const withSourceMaps = require('@zeit/next-source-maps')

const settings = withSourceMaps({
webpack(config) {
return config
},
env: {
SENTRY_DSN: process.env.SENTRY_DSN
}
})

module.exports = settings
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"homepage": "https://github.com/iterative/dvc.org#readme",
"dependencies": {
"@sentry/browser": "^5.12.1",
"color": "^3.1.2",
"dom-scroll-into-view": "^2.0.1",
"github-markdown-css": "^3.0.1",
Expand Down Expand Up @@ -59,6 +60,7 @@
},
"devDependencies": {
"@babel/core": "^7.7.7",
"@zeit/next-source-maps": "^0.0.3",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"babel-plugin-transform-define": "^2.0.0",
Expand Down
41 changes: 41 additions & 0 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* global process */

import React from 'react'
import App from 'next/app'
import * as Sentry from '@sentry/browser'

Sentry.init({
dsn: process.env.SENTRY_DSN
})

class MyApp extends App {
static async getInitialProps({ Component, ctx }) {
let pageProps = {}

if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx)
}

return { pageProps }
}

componentDidCatch(error, errorInfo) {
Sentry.withScope(scope => {
Object.keys(errorInfo).forEach(key => {
scope.setExtra(key, errorInfo[key])
})

Sentry.captureException(error)
})

super.componentDidCatch(error, errorInfo)
}

render() {
const { Component, pageProps } = this.props

return <Component {...pageProps} />
}
}

export default MyApp
11 changes: 11 additions & 0 deletions pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
/* eslint-env node */

import React from 'react'
import Document, { Head, Main, NextScript } from 'next/document'
import { ServerStyleSheet } from 'styled-components'
import * as Sentry from '@sentry/browser'

process.on('unhandledRejection', err => {
Sentry.captureException(err)
})

process.on('uncaughtException', err => {
Sentry.captureException(err)
})

import {
META_BASE_TITLE,
Expand Down
59 changes: 58 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,58 @@
dependencies:
any-observable "^0.3.0"

"@sentry/browser@^5.12.1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.12.1.tgz#dc1f268595269fb7277f55eb625c7e92d76dc01b"
integrity sha512-Zl7VdppUxctyaoqMSEhnDJp2rrupx8n8N2n3PSooH74yhB2Z91nt84mouczprBsw3JU1iggGyUw9seRFzDI1hw==
dependencies:
"@sentry/core" "5.12.0"
"@sentry/types" "5.12.0"
"@sentry/utils" "5.12.0"
tslib "^1.9.3"

"@sentry/[email protected]":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.12.0.tgz#d6380c4ef7beee5f418ac1d0e5be86a2de2af449"
integrity sha512-wY4rsoX71QsGpcs9tF+OxKgDPKzIFMRvFiSRcJoPMfhFsTilQ/CBMn/c3bDtWQd9Bnr/ReQIL6NbnIjUsPHA4Q==
dependencies:
"@sentry/hub" "5.12.0"
"@sentry/minimal" "5.12.0"
"@sentry/types" "5.12.0"
"@sentry/utils" "5.12.0"
tslib "^1.9.3"

"@sentry/[email protected]":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.12.0.tgz#5e8c8f249f5bdbeb8cc4ec02c2ccc53a67f2cc02"
integrity sha512-3k7yE8BEVJsKx8mR4LcI4IN0O8pngmq44OcJ/fRUUBAPqsT38jsJdP2CaWhdlM1jiNUzUDB1ktBv6/lY+VgcoQ==
dependencies:
"@sentry/types" "5.12.0"
"@sentry/utils" "5.12.0"
tslib "^1.9.3"

"@sentry/[email protected]":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.12.0.tgz#2611e2aa520c1edb7999e6de51bd65ec66341757"
integrity sha512-fk73meyz4k4jCg9yzbma+WkggsfEIQWI2e2TWfYsRGcrV3RnlSrXyM4D91/A8Bjx10SNezHPUFHjasjlHXOkyA==
dependencies:
"@sentry/hub" "5.12.0"
"@sentry/types" "5.12.0"
tslib "^1.9.3"

"@sentry/[email protected]":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.12.0.tgz#5367e53c74261beea01502e3f7b6f3d822682a31"
integrity sha512-aZbBouBLrKB8wXlztriIagZNmsB+wegk1Jkl6eprqRW/w24Sl/47tiwH8c5S4jYTxdAiJk+SAR10AAuYmIN3zg==

"@sentry/[email protected]":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.12.0.tgz#62967f934a3ee6d21472eac0219084e37225933e"
integrity sha512-fYUadGLbfTCbs4OG5hKCOtv2jrNE4/8LHNABy9DwNJ/t5DVtGqWAZBnxsC+FG6a3nVqCpxjFI9AHlYsJ2wsf7Q==
dependencies:
"@sentry/types" "5.12.0"
tslib "^1.9.3"

"@types/babel__core@^7.1.0":
version "7.1.3"
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30"
Expand Down Expand Up @@ -1345,6 +1397,11 @@
resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d"
integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==

"@zeit/next-source-maps@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@zeit/next-source-maps/-/next-source-maps-0.0.3.tgz#d62e93b4f5ccdd542c8530d21f60dd2757d98e3c"
integrity sha512-gFDf7yQI8r/fdzTKJG9cp0rhKscRJWs/uebhScj8nZINT16kPTVm23JAi5EivO5pAJmHGzT1A8dwxAhTX0liNw==

abab@^2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a"
Expand Down Expand Up @@ -8530,7 +8587,7 @@ ts-pnp@^1.1.2:
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.1.5.tgz#840e0739c89fce5f3abd9037bb091dbff16d9dec"
integrity sha512-ti7OGMOUOzo66wLF3liskw6YQIaSsBgc4GOAlWRnIEj8htCxJUxskanMUoJOD6MDCRAXo36goXJZch+nOS0VMA==

tslib@^1.9.0:
tslib@^1.9.0, tslib@^1.9.3:
version "1.10.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
Expand Down

0 comments on commit de1857b

Please sign in to comment.