Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/upgrade sentry packages #2303

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
18 changes: 11 additions & 7 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
});

// Use the SentryWebpack plugin to upload the source maps during build step
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");

const {
NEXT_PUBLIC_SENTRY_DSN: SENTRY_DSN,
@@ -93,12 +93,16 @@ const nextConfig = {
NODE_ENV === 'production'
) {
config.plugins.push(
new SentryWebpackPlugin({
include: '.next',
ignore: ['node_modules'],
stripPrefix: ['webpack://_N_E/'],
urlPrefix: `~${basePath}/_next`,
release: COMMIT_SHA,
sentryWebpackPlugin({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
// deprecated parameters from older version
//include: '.next',
//ignore: ['node_modules'],
//stripPrefix: ['webpack://_N_E/'],
//urlPrefix: `~${basePath}/_next`,
//release: COMMIT_SHA,
})
);
}
2,536 changes: 2,121 additions & 415 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -58,10 +58,9 @@
"@next/bundle-analyzer": "^10.2.3",
"@planet-sdk/common": "^0.1.41",
"@prisma/client": "^4.13.0",
"@sentry/browser": "^6.15.0",
"@sentry/integrations": "^6.19.2",
"@sentry/node": "^6.19.2",
"@sentry/webpack-plugin": "^1.20.1",
"@sentry/browser": "^8.37.1",
"@sentry/node": "^8.37.1",
"@sentry/webpack-plugin": "^2.22.6",
"@tanstack/react-query": "^4.29.5",
"@trpc/client": "^10.25.0",
"@trpc/next": "^10.25.0",
11 changes: 5 additions & 6 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
import './../src/features/common/Layout/Navbar/Navbar.scss';
import ThemeProvider from '../src/theme/themeContext';
import * as Sentry from '@sentry/node';
import { RewriteFrames } from '@sentry/integrations';
import getConfig from 'next/config';
import { useRouter } from 'next/router';
import { storeConfig } from '../src/utils/storeConfig';
@@ -64,14 +63,14 @@
const distDir = `${config.serverRuntimeConfig.rootDir}/.next`;
Sentry.init({
enabled: process.env.NODE_ENV === 'production',
integrations: [
new RewriteFrames({
integrations: [Sentry.rewriteFramesIntegration(
{
iteratee: (frame) => {
frame.filename = frame.filename?.replace(distDir, 'app:///_next');
return frame;
},
}),
],
}
)],
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// from https://gist.github.com/pioug/b006c983538538066ea871d299d8e8bc,
// also see https://docs.sentry.io/platforms/javascript/configuration/filtering/#decluttering-sentry
@@ -98,7 +97,7 @@
/window\._sharedData\.entry_data/,
/ztePageScrollModule/,
],
denyUrls: [],
// denyUrls: [], //commented out as this option is currently not utilized
});
}

@@ -139,30 +138,30 @@
isMobile: boolean;
};

const PlanetWeb = ({
Component,
pageProps,
emotionCache = clientSideEmotionCache,
}: AppPropsWithLayout) => {
const router = useRouter();
const [isMap, setIsMap] = React.useState(false);
const [currencyCode, setCurrencyCode] = React.useState('');
const [browserCompatible, setBrowserCompatible] = React.useState(false);

const { tenantConfig } = pageProps;

const tagManagerArgs = {
gtmId: process.env.NEXT_PUBLIC_GA_TRACKING_ID,
};

if (process.env.NODE_ENV !== 'production') {
if (process.env.VERCEL_URL && typeof window !== 'undefined') {
if (process.env.VERCEL_URL !== window.location.hostname) {
router.replace(`https://${process.env.VERCEL_URL}`);
}
}
}

Check notice on line 164 in pages/_app.tsx

codefactor.io / CodeFactor

pages/_app.tsx#L141-L164

Complex Method
React.useEffect(() => {
storeConfig(tenantConfig);
}, []);