Skip to content

Commit

Permalink
Merge pull request #748 from FleetAdmiralJakob/add-sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
FleetAdmiralJakob authored Nov 27, 2024
2 parents cdfd3f6 + 6eff3cb commit 101b7ee
Show file tree
Hide file tree
Showing 11 changed files with 2,004 additions and 68 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ CLERK_SECRET_KEY="sk_test_..."
CONVEX_DEPLOYMENT="dev:..."

NEXT_PUBLIC_CONVEX_URL="https://..."

# Enviroment variables that Sentry will automatically set up for you
SENTRY_AUTH_TOKEN="sntrys_..."
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ yarn-error.log*
# typescript
*.tsbuildinfo

# PWA
public/sw.js
# PWA / Serwist
public/sw*
public/swe-worker*
.env.local

# Sentry Config File
.env.sentry-build-plugin
7 changes: 6 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ export default [
},
},
{
files: ["convex/**", "src/env.ts"],
files: [
"convex/**",
"src/env.ts",
"next.config.js",
"src/instrumentation.ts",
],
rules: {
"no-restricted-properties": "off",
"no-restricted-imports": "off",
Expand Down
43 changes: 42 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { fileURLToPath } from "node:url";
import { withSentryConfig } from "@sentry/nextjs";
import withSerwistInit from "@serwist/next";
import createJiti from "jiti";

Expand All @@ -16,7 +17,7 @@ const jiti = createJiti(fileURLToPath(import.meta.url));
jiti("./src/env.ts");

/** @type {import("next").NextConfig} */
const config = withSerwist({
const baseConfig = withSerwist({
transpilePackages: ["geist"],
experimental: {
reactCompiler: true,
Expand All @@ -32,4 +33,44 @@ const config = withSerwist({
},
});

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

org: "jakob-rossner",
project: "chat-io",

// 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,

// Automatically annotate React components to show their full name in breadcrumbs and session replay
reactComponentAnnotation: {
enabled: true,
},

// 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,
});

export default config;
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"convex:deploy": "convex deploy"
},
"dependencies": {
"@clerk/nextjs": "^6.3.4",
"@clerk/shared": "^2.14.0",
"@clerk/nextjs": "^6.5.1",
"@clerk/shared": "^2.17.0",
"@floating-ui/react": "^0.26.28",
"@hookform/resolvers": "^3.9.1",
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
Expand All @@ -31,13 +31,14 @@
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.4",
"@sentry/nextjs": "^8",
"@serwist/next": "9.0.10",
"@t3-oss/env-nextjs": "^0.11.1",
"babel-plugin-react-compiler": "19.0.0-beta-6fc168f-20241025",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cmdk": "^1.0.4",
"convex": "^1.17.2",
"convex": "^1.17.3",
"convex-ents": "^0.13.0",
"convex-helpers": "^0.1.65",
"dayjs": "^1.11.13",
Expand Down
Loading

0 comments on commit 101b7ee

Please sign in to comment.