Skip to content

Commit 7e444e7

Browse files
committed
feat: re-add sentry, bump nextjs version
1 parent 55dd8f7 commit 7e444e7

File tree

9 files changed

+123
-1
lines changed

9 files changed

+123
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ venv
1313
.venv
1414
__pycache__/
1515
.sentryclirc
16+
.env.sentry-build-plugin

apps/stardew.app/next.config.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,40 @@ const nextConfig = {
3838
},
3939
};
4040

41+
// Injected content via Sentry wizard below
42+
43+
const { withSentryConfig } = require("@sentry/nextjs");
44+
45+
module.exports = withSentryConfig(module.exports, {
46+
// For all available options, see:
47+
// https://www.npmjs.com/package/@sentry/webpack-plugin#options
48+
49+
org: "communitycenter",
50+
project: "stardewapp",
51+
52+
// Only print logs for uploading source maps in CI
53+
silent: !process.env.CI,
54+
55+
// For all available options, see:
56+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
57+
58+
// Upload a larger set of source maps for prettier stack traces (increases build time)
59+
widenClientFileUpload: true,
60+
61+
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
62+
// This can increase your server load as well as your hosting bill.
63+
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
64+
// side errors will fail.
65+
tunnelRoute: "/monitoring",
66+
67+
// Automatically tree-shake Sentry logger statements to reduce bundle size
68+
disableLogger: true,
69+
70+
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
71+
// See the following for more information:
72+
// https://docs.sentry.io/product/crons/
73+
// https://vercel.com/docs/cron-jobs
74+
automaticVercelMonitors: true,
75+
});
76+
4177
module.exports = nextConfig;

apps/stardew.app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"@radix-ui/react-toggle-group": "^1.1.10",
4141
"@radix-ui/react-tooltip": "^1.0.6",
4242
"@react-hook/media-query": "^1.1.1",
43+
"@sentry/nextjs": "^10",
4344
"@tabler/icons-react": "^2.30.0",
4445
"@types/node": "20.4.0",
4546
"@types/react": "18.2.14",
@@ -56,7 +57,7 @@
5657
"fast-xml-parser": "^4.2.6",
5758
"lucide-react": "^0.522.0",
5859
"mysql2": "^3.10.1",
59-
"next": "^14.2.3",
60+
"next": "^15.5.2",
6061
"next-themes": "^0.2.1",
6162
"postcss": "8.4.24",
6263
"react": "18.2.0",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
2+
// The config you add here will be used whenever one of the edge features is loaded.
3+
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
4+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
5+
6+
import * as Sentry from "@sentry/nextjs";
7+
8+
Sentry.init({
9+
dsn: "https://2f557a537a56e11d3bdf60941649b239@o4506080157958144.ingest.us.sentry.io/4506080163790848",
10+
11+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
12+
tracesSampleRate: 1,
13+
14+
// Enable logs to be sent to Sentry
15+
enableLogs: true,
16+
17+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
18+
debug: false,
19+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This file configures the initialization of Sentry on the server.
2+
// The config you add here will be used whenever the server handles a request.
3+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
4+
5+
import * as Sentry from "@sentry/nextjs";
6+
7+
Sentry.init({
8+
dsn: "https://2f557a537a56e11d3bdf60941649b239@o4506080157958144.ingest.us.sentry.io/4506080163790848",
9+
10+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
11+
tracesSampleRate: 1,
12+
13+
// Enable logs to be sent to Sentry
14+
enableLogs: true,
15+
16+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
17+
debug: false,
18+
});
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// This file configures the initialization of Sentry on the client.
2+
// The added config here will be used whenever a users loads a page in their browser.
3+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
4+
5+
import * as Sentry from "@sentry/nextjs";
6+
7+
Sentry.init({
8+
dsn: "https://2f557a537a56e11d3bdf60941649b239@o4506080157958144.ingest.us.sentry.io/4506080163790848",
9+
10+
// Add optional integrations for additional features
11+
integrations: [
12+
Sentry.replayIntegration(),
13+
],
14+
15+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
16+
tracesSampleRate: 1,
17+
// Enable logs to be sent to Sentry
18+
enableLogs: true,
19+
20+
// Define how likely Replay events are sampled.
21+
// This sets the sample rate to be 10%. You may want this to be 100% while
22+
// in development and sample at a lower rate in production
23+
replaysSessionSampleRate: 0.1,
24+
25+
// Define how likely Replay events are sampled when an error occurs.
26+
replaysOnErrorSampleRate: 1.0,
27+
28+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
29+
debug: false,
30+
});
31+
32+
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as Sentry from '@sentry/nextjs';
2+
3+
export async function register() {
4+
if (process.env.NEXT_RUNTIME === 'nodejs') {
5+
await import('../sentry.server.config');
6+
}
7+
8+
if (process.env.NEXT_RUNTIME === 'edge') {
9+
await import('../sentry.edge.config');
10+
}
11+
}
12+
13+
export const onRequestError = Sentry.captureRequestError;

apps/stardew.app/src/pages/_error.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as Sentry from "@sentry/nextjs";
12
import Error from "next/error";
23

34
// @ts-expect-error Pages router
@@ -7,6 +8,7 @@ const CustomErrorComponent = (props) => {
78

89
// @ts-expect-error Pages router
910
CustomErrorComponent.getInitialProps = async (contextData) => {
11+
await Sentry.captureUnderscoreErrorException(contextData);
1012
return Error.getInitialProps(contextData);
1113
};
1214

bun.lockb

102 KB
Binary file not shown.

0 commit comments

Comments
 (0)