diff --git a/next.config.js b/next.config.js index 8264b84..9e75370 100644 --- a/next.config.js +++ b/next.config.js @@ -4,6 +4,12 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({ const withPWA = require("next-pwa"); const runtimeCaching = require("next-pwa/cache"); +const { withSentryConfig } = require("@sentry/nextjs"); + +const SentryWebpackPluginOptions = { + silent: true, +}; + const isDevelopment = process.env.NODE_ENV === "development"; // @ts-check @@ -68,4 +74,6 @@ const nextConfig = { }, }; -module.exports = isDevelopment ? nextConfig : withPWA(withBundleAnalyzer(nextConfig)); +module.exports = isDevelopment + ? nextConfig + : withSentryConfig(withPWA(withBundleAnalyzer(nextConfig)), SentryWebpackPluginOptions); diff --git a/pages/api/analytics.ts b/pages/api/analytics.ts index cd24f0e..a299f57 100644 --- a/pages/api/analytics.ts +++ b/pages/api/analytics.ts @@ -1,3 +1,4 @@ +import { withSentry } from "@sentry/nextjs"; import { google } from "googleapis"; import type { NextApiRequest, NextApiResponse } from "next"; @@ -33,4 +34,4 @@ const handlers = async (_: NextApiRequest, res: NextApiResponse) => { }); }; -export default handlers; +export default withSentry(handlers); diff --git a/pages/api/endorsement.ts b/pages/api/endorsement.ts index 540e807..897bb54 100644 --- a/pages/api/endorsement.ts +++ b/pages/api/endorsement.ts @@ -1,4 +1,5 @@ import prisma from "@/lib/prisma"; +import { withSentry } from "@sentry/nextjs"; import type { NextApiRequest, NextApiResponse } from "next"; import { getSession } from "next-auth/react"; @@ -18,4 +19,4 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { return res.send("Method not allowed."); } -export default handler; +export default withSentry(handler); diff --git a/pages/api/guestbook/[id].ts b/pages/api/guestbook/[id].ts index 3d7ef91..d28d6fd 100644 --- a/pages/api/guestbook/[id].ts +++ b/pages/api/guestbook/[id].ts @@ -1,4 +1,5 @@ import { getSession } from "next-auth/react"; +import { withSentry } from "@sentry/nextjs"; import type { NextApiRequest, NextApiResponse } from "next"; import prisma from "@/lib/prisma"; import { GuestBookEntry } from "@/lib/types/guestbook"; @@ -58,4 +59,4 @@ const guestbookEntries = async ( return res.send("Method not allowed."); }; -export default guestbookEntries; +export default withSentry(guestbookEntries); diff --git a/pages/api/guestbook/index.ts b/pages/api/guestbook/index.ts index 56637e5..5a822e6 100644 --- a/pages/api/guestbook/index.ts +++ b/pages/api/guestbook/index.ts @@ -1,4 +1,5 @@ import { getSession } from "next-auth/react"; +import { withSentry } from "@sentry/nextjs"; import type { NextApiRequest, NextApiResponse } from "next"; import prisma from "@/lib/prisma"; import { GuestBookEntry } from "@/lib/types/guestbook"; @@ -57,4 +58,4 @@ const handler = async ( return res.send("Method not allowed."); }; -export default handler; +export default withSentry(handler); diff --git a/pages/api/now-playing.ts b/pages/api/now-playing.ts index ac15d83..9e81178 100644 --- a/pages/api/now-playing.ts +++ b/pages/api/now-playing.ts @@ -1,4 +1,5 @@ import { getNowPlaying } from "@/lib/spotify"; +import { withSentry } from "@sentry/nextjs"; import type { NextApiRequest, NextApiResponse } from "next"; export interface NowPlayingSong { @@ -40,4 +41,4 @@ async function handler(_: NextApiRequest, res: NextApiResponse) } } -export default handler; +export default withSentry(handler); diff --git a/pages/api/skill-category.ts b/pages/api/skill-category.ts index 3f3b29d..c927712 100644 --- a/pages/api/skill-category.ts +++ b/pages/api/skill-category.ts @@ -1,5 +1,6 @@ import { getAllSkillsByCategory } from "@/lib/db"; import { SkillCategory } from "@/lib/types/skill"; +import { withSentry } from "@sentry/nextjs"; import type { NextApiRequest, NextApiResponse } from "next"; async function handler(req: NextApiRequest, res: NextApiResponse) { @@ -10,4 +11,4 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { @@ -33,4 +34,4 @@ async function handler(req: NextApiRequest, res: NextApiResponse