mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-05-15 20:54:28 -04:00
add sentry to investigate 500 errors
This commit is contained in:
@@ -34,3 +34,6 @@ yarn.lock
|
|||||||
|
|
||||||
# vercel
|
# vercel
|
||||||
.vercel
|
.vercel
|
||||||
|
|
||||||
|
# Sentry Config File
|
||||||
|
.env.sentry-build-plugin
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import * as Sentry from "@sentry/nextjs";
|
||||||
|
import NextError from "next/error";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
|
export default function GlobalError({ error }: { error: Error & { digest?: string } }) {
|
||||||
|
useEffect(() => {
|
||||||
|
Sentry.captureException(error);
|
||||||
|
}, [error]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
{/* `NextError` is the default Next.js error page component. Its type
|
||||||
|
definition requires a `statusCode` prop. However, since the App Router
|
||||||
|
does not expose status codes for errors, we simply pass 0 to render a
|
||||||
|
generic error message. */}
|
||||||
|
<NextError statusCode={0} />
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
);
|
||||||
|
}
|
||||||
+5
-6
@@ -1,4 +1,3 @@
|
|||||||
import { useId } from "react";
|
|
||||||
import { GoLock } from "react-icons/go";
|
import { GoLock } from "react-icons/go";
|
||||||
import { rgba } from "polished";
|
import { rgba } from "polished";
|
||||||
import Link from "../components/Link";
|
import Link from "../components/Link";
|
||||||
@@ -16,15 +15,15 @@ const ColorfulLink = ({
|
|||||||
lightColor: string;
|
lightColor: string;
|
||||||
darkColor: string;
|
darkColor: string;
|
||||||
}) => {
|
}) => {
|
||||||
const uniqueId = `Link_themed__${useId().replace(/\W/g, "")}`;
|
const uniqueId = `Link_themed__${lightColor.replace("#", "")}_${darkColor.replace("#", "")}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Link id={uniqueId} {...rest}>
|
<Link className={uniqueId} {...rest}>
|
||||||
{children}
|
{children}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<style>{`.${styles.page} #${uniqueId}{color:${lightColor};--colors-linkUnderline:${rgba(lightColor, 0.4)}}[data-theme="dark"] .${styles.page} #${uniqueId}{color:${darkColor};--colors-linkUnderline:${rgba(darkColor, 0.4)}}`}</style>
|
<style>{`.${styles.page} .${uniqueId}{--colors-link:${lightColor};--colors-linkUnderline:${rgba(lightColor, 0.4)}}[data-theme="dark"] .${styles.page} .${uniqueId}{--colors-link:${darkColor};--colors-linkUnderline:${rgba(darkColor, 0.4)}}`}</style>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -278,8 +277,8 @@ export default function Page() {
|
|||||||
href="https://bsky.app/profile/jarv.is"
|
href="https://bsky.app/profile/jarv.is"
|
||||||
rel="me"
|
rel="me"
|
||||||
title="Jake Jarvis on Bluesky"
|
title="Jake Jarvis on Bluesky"
|
||||||
lightColor="#0085FF"
|
lightColor="#0085ff"
|
||||||
darkColor="#208BFE"
|
darkColor="#208bfe"
|
||||||
>
|
>
|
||||||
Bluesky
|
Bluesky
|
||||||
</ColorfulLink>
|
</ColorfulLink>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import * as Sentry from "@sentry/nextjs";
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const onRequestError = Sentry.captureRequestError;
|
||||||
+3
-1
@@ -19,5 +19,7 @@ export function middleware(request: NextRequest) {
|
|||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
// save compute time by skipping middleware for static and metadata files
|
// save compute time by skipping middleware for static and metadata files
|
||||||
matcher: ["/((?!_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt|manifest.webmanifest).*)"],
|
matcher: [
|
||||||
|
"/((?!_next/static|_next/image|_vercel|_instrument|favicon.ico|sitemap.xml|robots.txt|manifest.webmanifest).*)",
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
+15
-1
@@ -1,6 +1,7 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
import createMDX from "@next/mdx";
|
import createMDX from "@next/mdx";
|
||||||
import createBundleAnalyzer from "@next/bundle-analyzer";
|
import createBundleAnalyzer from "@next/bundle-analyzer";
|
||||||
|
import { withSentryConfig } from "@sentry/nextjs";
|
||||||
import * as mdxPlugins from "./lib/helpers/remark-rehype-plugins";
|
import * as mdxPlugins from "./lib/helpers/remark-rehype-plugins";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
@@ -155,4 +156,17 @@ const withMDX = createMDX({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default withBundleAnalyzer(withMDX(nextConfig));
|
export default withSentryConfig(withBundleAnalyzer(withMDX(nextConfig)), {
|
||||||
|
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/build/
|
||||||
|
org: process.env.SENTRY_ORG,
|
||||||
|
project: process.env.SENTRY_PROJECT,
|
||||||
|
silent: !process.env.CI,
|
||||||
|
widenClientFileUpload: true,
|
||||||
|
autoInstrumentAppDirectory: true,
|
||||||
|
autoInstrumentMiddleware: false,
|
||||||
|
autoInstrumentServerFunctions: true,
|
||||||
|
tunnelRoute: "/_instrument/",
|
||||||
|
disableLogger: true,
|
||||||
|
automaticVercelMonitors: true,
|
||||||
|
telemetry: false,
|
||||||
|
});
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
"@octokit/graphql-schema": "^15.26.0",
|
"@octokit/graphql-schema": "^15.26.0",
|
||||||
"@prisma/client": "^6.4.1",
|
"@prisma/client": "^6.4.1",
|
||||||
"@react-spring/web": "^9.7.5",
|
"@react-spring/web": "^9.7.5",
|
||||||
|
"@sentry/nextjs": "^9.3.0",
|
||||||
"@vercel/analytics": "^1.5.0",
|
"@vercel/analytics": "^1.5.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"comma-number": "^2.1.0",
|
"comma-number": "^2.1.0",
|
||||||
|
|||||||
Generated
+1915
-14
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
|||||||
|
// This file configures the initialization of Sentry on the client.
|
||||||
|
// The config you add here will be used whenever a users loads a page in their browser.
|
||||||
|
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
||||||
|
|
||||||
|
import * as Sentry from "@sentry/nextjs";
|
||||||
|
|
||||||
|
Sentry.init({
|
||||||
|
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN || process.env.SENTRY_DSN,
|
||||||
|
environment: process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.NODE_ENV,
|
||||||
|
tracesSampleRate: 1,
|
||||||
|
});
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// 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: process.env.NEXT_PUBLIC_SENTRY_DSN || process.env.SENTRY_DSN,
|
||||||
|
environment: process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.NODE_ENV,
|
||||||
|
tracesSampleRate: 1,
|
||||||
|
});
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// This file configures the initialization of Sentry on the server.
|
||||||
|
// The config you add here will be used whenever the server handles a request.
|
||||||
|
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
||||||
|
|
||||||
|
import * as Sentry from "@sentry/nextjs";
|
||||||
|
|
||||||
|
Sentry.init({
|
||||||
|
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN || process.env.SENTRY_DSN,
|
||||||
|
environment: process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.NODE_ENV,
|
||||||
|
tracesSampleRate: 1,
|
||||||
|
integrations: [Sentry.prismaIntegration()],
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user