Skip to content

Commit

Permalink
Merge pull request #124 from gruz0/feature/add-sentry
Browse files Browse the repository at this point in the history
Add Sentry
  • Loading branch information
gruz0 authored Nov 11, 2024
2 parents 4e3abf1 + 39c3b4a commit 494a4fe
Show file tree
Hide file tree
Showing 21 changed files with 2,824 additions and 230 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export REDIS_URL="redis://localhost:6379"
# SQLite database file path. Adjust the path as per your local setup.
export DATABASE_URL="file:/Users/username/Projects/database.db"

# URL for Sentry.io Tracking
export SENTRY_DSN="https://[email protected]/dsn"

# Used to interact with Idea API from the backend side.
export IDEA_SERVICE_API_BASE="http://localhost:3000/api"

Expand Down
3 changes: 3 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export REDIS_URL="redis://localhost:6379"
# SQLite database file path. Adjust the path as per your local setup.
export DATABASE_URL="file:./database.test.db"

# URL for Sentry.io Tracking
export SENTRY_DSN="https://[email protected]/dsn"

# Used to interact with Idea API from the backend side.
export IDEA_SERVICE_API_BASE="http://localhost:3000/api"

Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ ENV REDIS_URL=$REDIS_URL
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL

ARG SENTRY_DSN
ENV SENTRY_DSN=$SENTRY_DSN

ARG NEXT_PUBLIC_URL
ENV NEXT_PUBLIC_URL=$NEXT_PUBLIC_URL

Expand Down
1 change: 1 addition & 0 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
- OPENAI_API_KEY=${OPENAI_API_KEY}
- REDIS_URL=${REDIS_URL}
- DATABASE_URL=${DATABASE_URL}
- SENTRY_DSN=${SENTRY_DSN}
- CREATE_IDEA_LIMITER_LIMIT=${CREATE_IDEA_LIMITER_LIMIT}
- CREATE_IDEA_LIMITER_TIMEFRAME=${CREATE_IDEA_LIMITER_TIMEFRAME}
- IDEA_SERVICE_API_BASE=${IDEA_SERVICE_API_BASE}
Expand Down
37 changes: 34 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import withBundleAnalyzer from '@next/bundle-analyzer'
import { withSentryConfig } from '@sentry/nextjs'

/** @type {import('next').NextConfig} */
const nextConfig = {
poweredByHeader: false,
Expand All @@ -7,12 +10,40 @@ const nextConfig = {
productionBrowserSourceMaps: false,
}

import withBundleAnalyzer from '@next/bundle-analyzer'

const bundleAnalyzer = withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
analyzerMode: 'static',
logLevel: 'info',
})

export default bundleAnalyzer(nextConfig)
export default withSentryConfig(bundleAnalyzer(nextConfig), {
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

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

// 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: false,
})
Loading

0 comments on commit 494a4fe

Please sign in to comment.