Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,23 @@ const nextConfig = {
},
};

// Disable Sentry to save memory during builds - comment out this line and uncomment block below to re-enable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Misleading comment - disables Sentry at runtime, not just during builds.

The comment states this saves memory "during builds," but exporting nextConfig directly disables Sentry integration entirely, including at runtime in production. This affects error tracking and monitoring in your live application, not just the build process.

If the goal is specifically to reduce build memory usage, consider using the existing LOW_MEMORY_BUILD environment variable (referenced in line 140) to disable only sourcemaps during builds, while keeping Sentry active at runtime.

🤖 Prompt for AI Agents
In next.config.mjs around line 128, the comment incorrectly says Sentry is
disabled "during builds" while exporting nextConfig actually disables Sentry at
runtime too; update the comment to clearly state that exporting nextConfig
disables Sentry integration at runtime (production) and not only during builds,
and either revert to the previous Sentry-enabled export or change the logic to
gate only build-time behavior behind the LOW_MEMORY_BUILD env var (so
sourcemaps/build memory can be reduced) while keeping Sentry middleware/config
active at runtime.

export default nextConfig;
Comment on lines +128 to +129
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Disabling Sentry removes critical production observability.

Exporting nextConfig directly completely disables Sentry error tracking and performance monitoring in production, not just during builds. This significantly degrades your ability to debug production issues and monitor application health.

Impact:

  • No error tracking or crash reports
  • No performance monitoring
  • Loss of production observability
  • Unable to proactively identify and debug issues

Alternative approaches to consider:

  1. Use the existing LOW_MEMORY_BUILD environment variable with conditional logic rather than commenting out the entire integration
  2. Disable only sourcemaps during builds (already controlled by sourcemaps.disable in line 140)
  3. Use environment-based conditional Sentry initialization (enable only in production, disable in development/CI)
  4. Address the root cause of the build memory issue mentioned in the PR title
💡 Example: Conditional Sentry configuration based on environment
-// Disable Sentry to save memory during builds - comment out this line and uncomment block below to re-enable
-export default nextConfig;
-
-/*
-export default withSentryConfig(nextConfig, {
+// Only enable Sentry in production or when explicitly requested
+const shouldEnableSentry = process.env.NODE_ENV === 'production' && process.env.DISABLE_SENTRY !== 'true';
+
+export default shouldEnableSentry ? withSentryConfig(nextConfig, {
   org: "Paycrest",
   project: "noblocks",
   sentryUrl: process.env.SENTRY_URL,
   authToken: process.env.SENTRY_AUTH_TOKEN,
   release: "2.0.0",
   silent: !process.env.CI,
   sourcemaps: {
     disable: process.env.LOW_MEMORY_BUILD === "true",
   },
   widenClientFileUpload: true,
   tunnelRoute: "/monitoring",
   disableLogger: true,
   automaticVercelMonitors: true,
-});
-*/
+}) : nextConfig;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In next.config.mjs around lines 128-129, the current direct export of nextConfig
disables Sentry entirely; restore conditional Sentry integration so production
observability remains. Update the file to initialize/wrap nextConfig with the
Sentry plugin only when not running a low-memory build (use
process.env.LOW_MEMORY_BUILD !== 'true') and/or when NODE_ENV === 'production',
otherwise export nextConfig untouched; preserve existing sourcemaps.disable
logic and any CI/dev checks so sourcemaps or other settings remain controlled
separately. Ensure the conditional preserves build-time behavior (skip Sentry
plugin during low-memory CI builds) but enables full Sentry error and
performance instrumentation in production.


/*
export default withSentryConfig(nextConfig, {
org: "Paycrest",

project: "noblocks",

sentryUrl: process.env.SENTRY_URL,

authToken: process.env.SENTRY_AUTH_TOKEN,

release: "2.0.0",

silent: !process.env.CI,

// Disable source map upload in low-memory environments
sourcemaps: {
disable: process.env.LOW_MEMORY_BUILD === "true",
},

widenClientFileUpload: true,

tunnelRoute: "/monitoring",

disableLogger: true,

automaticVercelMonitors: true,
});
*/
Loading