- Added Sentry client, server, and edge configurations for enhanced error monitoring. - Updated `.env.example` and `docker-compose` to include `NEXT_PUBLIC_SENTRY_DSN`. - Modified `next.config.ts` to use `withSentryConfig` for source map uploads. - Installed `@sentry/nextjs` as a dependency and updated `pnpm-lock.yaml`.
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { withSentryConfig } from "@sentry/nextjs";
|
|
import type { NextConfig } from "next";
|
|
|
|
const appUrl = process.env.NEXT_PUBLIC_APP_URL || "https://memegoat.fr";
|
|
const apiUrl = process.env.NEXT_PUBLIC_API_URL || "https://api.memegoat.fr";
|
|
|
|
const getHostname = (url: string) => {
|
|
try {
|
|
return new URL(url).hostname;
|
|
} catch {
|
|
return url;
|
|
}
|
|
};
|
|
|
|
const nextConfig: NextConfig = {
|
|
/* config options here */
|
|
reactCompiler: true,
|
|
images: {
|
|
remotePatterns: [
|
|
{
|
|
protocol: "https",
|
|
hostname: getHostname(appUrl),
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: getHostname(apiUrl),
|
|
},
|
|
],
|
|
},
|
|
output: "standalone",
|
|
};
|
|
|
|
export default withSentryConfig(nextConfig, {
|
|
// For all available options, see:
|
|
// https://github.com/getsentry/sentry-webpack-plugin#options
|
|
|
|
org: "yidhra",
|
|
project: "javascript-nextjs",
|
|
|
|
// 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 Sentry bill.
|
|
tunnelRoute: "/monitoring",
|
|
});
|