Skip to content

Commit

Permalink
app-content-pages: Remove Sentry, New Relic, and Million.js (#5762)
Browse files Browse the repository at this point in the history
* remove sentry, new relic, and million

* remove outdated next-absolute-path
  • Loading branch information
goplayoutside3 authored Dec 15, 2023
1 parent ec27331 commit acc8dd2
Show file tree
Hide file tree
Showing 23 changed files with 4 additions and 359 deletions.
1 change: 0 additions & 1 deletion packages/app-content-pages/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ function webpackFinal(config, options) {
...config.resolve,
alias: {
...webpackConfig.resolve.alias,
['@sentry/node']: '@sentry/browser',
'next-i18next': 'react-i18next'
},
fallback: {
Expand Down
1 change: 0 additions & 1 deletion packages/app-content-pages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ A [Next.js](https://github.com/zeit/next.js) app for handling the content pages.
## Ops

- [Jenkins](https://jenkins.zooniverse.org/job/Zooniverse%20GitHub/job/front-end-monorepo/)
- [New Relic](https://rpm.newrelic.com/accounts/23619/applications/319037799)

## Getting started

Expand Down
24 changes: 0 additions & 24 deletions packages/app-content-pages/newrelic.js

This file was deleted.

35 changes: 3 additions & 32 deletions packages/app-content-pages/next.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
if (process.env.NEWRELIC_LICENSE_KEY) {
require('newrelic')
}

require('dotenv').config()

const million = require('million/compiler')
const { execSync } = require('child_process')
const Dotenv = require('dotenv-webpack')
const path = require('path')
const { withSentryConfig } = require('@sentry/nextjs')
const { i18n } = require('./next-i18next.config')

const assetPrefixes = {}
Expand All @@ -21,10 +15,8 @@ function commitID () {
}
}

const isDevelopment = process.env.NODE_ENV === 'development'
const PANOPTES_ENV = process.env.PANOPTES_ENV || 'staging'
const webpackConfig = require('./webpack.config')
const SENTRY_CONTENT_DSN = isDevelopment ? '' : 'https://[email protected]/1492498'
const APP_ENV = process.env.APP_ENV || 'development'
const COMMIT_ID = process.env.COMMIT_ID || commitID()
const assetPrefix = assetPrefixes[APP_ENV]
Expand All @@ -44,12 +36,12 @@ const nextConfig = {
env: {
COMMIT_ID,
PANOPTES_ENV,
SENTRY_CONTENT_DSN,
APP_ENV
},

experimental: {
forceSwcTransforms: true
forceSwcTransforms: true,
optimizePackageImports: ['@zooniverse/react-components', 'grommet', 'grommet-icons']
},

/** localeDetection is a Next.js feature, while the rest of i18n config pertains to next-i18next */
Expand All @@ -58,21 +50,8 @@ const nextConfig = {
...i18n
},

modularizeImports: {
lodash: {
transform: 'lodash/{{member}}',
},
'@zooniverse/react-components': {
transform: '@zooniverse/react-components/{{member}}'
}
},

reactStrictMode: true,

sentry: {
hideSourceMaps: true
},

webpack: (config, options) => {
config.plugins.concat([
new Dotenv({
Expand All @@ -96,12 +75,4 @@ const nextConfig = {
}
}

module.exports = million.next(
withSentryConfig(nextConfig, {
org: 'zooniverse-27',
project: 'fem-app-content-pages'
}),
{
auto: true
}
)
module.exports = nextConfig
4 changes: 0 additions & 4 deletions packages/app-content-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@sentry/nextjs": "~7.84.0",
"@zooniverse/async-states": "~0.0.1",
"@zooniverse/grommet-theme": "~3.2.0",
"@zooniverse/panoptes-js": "~0.5.0",
Expand All @@ -29,11 +28,8 @@
"grommet-icons": "~4.11.0",
"i18next": "~23.7.1",
"lodash": "~4.17.11",
"million": "~2.6.4",
"morgan": "^1.10.0",
"newrelic": "^11.0.0",
"next": "~13.5.5",
"next-absolute-url": "~1.2.2",
"next-i18next": "~15.1.1",
"panoptes-client": "~5.6.0",
"path-match": "~1.2.4",
Expand Down
2 changes: 0 additions & 2 deletions packages/app-content-pages/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Error from 'next/error'
import PageHeader from '../src/shared/components/PageHeader/PageHeader.js'
import { PanoptesAuthContext, ThemeModeContext } from '../src/shared/contexts'
import { usePanoptesUser } from '@zooniverse/react-components/hooks'
import { logReactError } from '../src/helpers/logger'

const GlobalStyle = createGlobalStyle`
body {
Expand Down Expand Up @@ -74,7 +73,6 @@ function MyApp({ Component, pageProps }) {
</PanoptesAuthContext.Provider>
)
} catch (error) {
logReactError(error)
return <Error statusCode={500} title={error.message} />
}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/app-content-pages/pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import Document from 'next/document'
import { ServerStyleSheet } from 'styled-components'

import { logNodeError } from '../src/helpers/logger'

process.on('unhandledRejection', logNodeError)
process.on('uncaughtException', logNodeError)

export default class MyDocument extends Document {
static async getInitialProps (ctx) {
const sheet = new ServerStyleSheet()
Expand Down
5 changes: 0 additions & 5 deletions packages/app-content-pages/pages/_error.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import * as Sentry from '@sentry/nextjs'
import NextErrorComponent from 'next/error'

const CustomErrorComponent = (props) => (
<NextErrorComponent statusCode={props.statusCode} />
)

CustomErrorComponent.getInitialProps = async (contextData) => {
// In case this is running in a serverless function, await this in order to give Sentry
// time to send the error before the lambda exits
await Sentry.captureUnderscoreErrorException(contextData)

// This will contain the status code of the response
return NextErrorComponent.getInitialProps(contextData)
}
Expand Down
2 changes: 0 additions & 2 deletions packages/app-content-pages/pages/publications.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import createPublicationsResponse from '../src/api/publications/publications.js'
import logNodeError from '../src/helpers/logger/logNodeError.js'
export { default } from '../src/screens/Publications'

export async function getStaticProps({ locale }) {
Expand All @@ -27,7 +26,6 @@ export async function getStaticProps({ locale }) {
revalidate: 60 * 60 * 1 // 1 hour
}
} catch (error) {
logNodeError(error)
throw error
}
}
2 changes: 0 additions & 2 deletions packages/app-content-pages/pages/team.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import createTeamResponse from '../src/api/team/team.js'
import logNodeError from '../src/helpers/logger/logNodeError.js'
export { default } from '../src/screens/Teams'

export async function getStaticProps({ locale }) {
Expand All @@ -27,7 +26,6 @@ export async function getStaticProps({ locale }) {
revalidate: 60 * 60 * 1 // 1 hour
}
} catch (error) {
logNodeError(error)
throw error
}
}
18 changes: 0 additions & 18 deletions packages/app-content-pages/sentry.client.config.js

This file was deleted.

14 changes: 0 additions & 14 deletions packages/app-content-pages/sentry.edge.config.js

This file was deleted.

15 changes: 0 additions & 15 deletions packages/app-content-pages/sentry.server.config.js

This file was deleted.

18 changes: 0 additions & 18 deletions packages/app-content-pages/server/server.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
if (process.env.NEWRELIC_LICENSE_KEY) {
require('newrelic')
}

const Sentry = require('@sentry/nextjs')
const express = require('express')
const next = require('next')

const setLogging = require('./set-logging')
const setCacheHeaders = require('./set-cache-headers')

const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'

Expand All @@ -28,20 +20,10 @@ const handle = app.getRequestHandler()
app.prepare().then(() => {
const server = express()

server.use(Sentry.Handlers.requestHandler())
setLogging(server)

server.get('*', (req, res) => {
setCacheHeaders(req, res)
return handle(req, res)
})

server.use(Sentry.Handlers.errorHandler())
server.use(function onError(error, req, res, next) {
res.statusCode = 500
res.end(res.sentry + "\n")
})

let selfsigned
try {
selfsigned = require('selfsigned')
Expand Down
25 changes: 0 additions & 25 deletions packages/app-content-pages/server/set-cache-headers.js

This file was deleted.

Loading

0 comments on commit acc8dd2

Please sign in to comment.