Skip to content

Commit

Permalink
feat: sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 committed Feb 11, 2024
1 parent acd1541 commit f5ee326
Show file tree
Hide file tree
Showing 9 changed files with 1,105 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ pass

.vercel
post.md

# Sentry Config File
.sentryclirc
19 changes: 19 additions & 0 deletions app/global-error.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"use client";

import * as Sentry from "@sentry/nextjs";
import Error from "next/error";
import { useEffect } from "react";

export default function GlobalError({ error }) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);

return (
<html>
<body>
<Error />
</body>
</html>
);
}
43 changes: 43 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,46 @@ const nextConfig = {
};

module.exports = nextConfig;


// Injected content via Sentry wizard below

const { withSentryConfig } = require("@sentry/nextjs");

module.exports = withSentryConfig(
module.exports,
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

// Suppresses source map uploading logs during build
silent: true,
org: "liuweiqing-limited",
project: "javascript-nextjs",
},
{
// 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,

// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,

// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
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.
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
}
);
Loading

0 comments on commit f5ee326

Please sign in to comment.