This commit is contained in:
Lee 2024-07-30 21:29:32 +01:00
parent 179b5eb9d2
commit 35e786d9a5
9 changed files with 875 additions and 202 deletions

3
.gitignore vendored

@ -50,3 +50,6 @@ next-env.d.ts
# Sitemap & Robots
/public/sitemap*
/public/robots.txt
# Sentry Config File
.env.sentry-build-plugin

@ -1,7 +1,7 @@
import {withSentryConfig} from "@sentry/nextjs";
import nextBuildId from "next-build-id";
import { fileURLToPath } from "url";
import path from "path";
import { fileURLToPath } from "url";
/**
* The current git commit hash.
@ -37,29 +37,38 @@ const nextConfig = {
},
};
export default withSentryConfig(
nextConfig,
{
export default withSentryConfig(nextConfig, {
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
silent: true,
org: "minecraft-utilities",
project: "frontend",
url: "https://glitchtip.fascinated.cc/",
authToken: process.env.SENTRY_AUTH_TOKEN || "",
release: `frontend@${buildId}`,
},
{
sentryUrl: "https://glitchtip.fascinated.cc/",
// Only print logs for uploading source maps in CI
silent: !process.env.CI,
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
// tunnelRoute: "/monitoring",
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
},
);
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
});

@ -25,7 +25,7 @@
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"@radix-ui/react-tooltip": "^1.0.7",
"@sentry/nextjs": "^7.105.0",
"@sentry/nextjs": "^8.20.0",
"@types/mdx": "^2.0.13",
"class-variance-authority": "^0.7.0",
"clipboard-copy": "^4.0.1",

964
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

@ -12,4 +12,19 @@ Sentry.init({
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
replaysOnErrorSampleRate: 1.0,
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
Sentry.replayIntegration({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});

16
sentry.edge.config.ts Normal file

@ -0,0 +1,16 @@
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
// The config you add here will be used whenever one of the edge features is loaded.
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: "https://25aaa031240f4d659649d28e0a3fb0cb@glitchtip.fascinated.cc/1",
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});

@ -13,6 +13,7 @@ Sentry.init({
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
// Uncomment the line below to enable Spotlight (https://spotlightjs.com)
// spotlight: process.env.NODE_ENV === 'development',
});

@ -1,4 +1,4 @@
const HASTE_URL: string = "https://paste.fascinated.cc";
const PASTE_URL: string = "https://paste.fascinated.cc";
/**
* Creates a new haste with the given content.
@ -7,11 +7,11 @@ const HASTE_URL: string = "https://paste.fascinated.cc";
* @returns the URL of the created haste
*/
export async function createHaste(content: string): Promise<string> {
const response = await fetch(`${HASTE_URL}/api/upload`, {
const response = await fetch(`${PASTE_URL}/api/upload`, {
method: "POST",
body: content,
});
const { id } = await response.json();
return `${HASTE_URL}/${id}`;
return `${PASTE_URL}/${id}`;
}

9
src/instrumentation.ts Normal file

@ -0,0 +1,9 @@
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('../sentry.server.config');
}
if (process.env.NEXT_RUNTIME === 'edge') {
await import('../sentry.edge.config');
}
}