Conversation
📝 WalkthroughWalkthroughThe changes modify Next.js and Sentry configurations: removing explicit production browser sourcemap generation from shared config, and introducing conditional Sentry sourcemap management based on the SENTRY_AUTH_TOKEN environment variable. When the token is present, sourcemaps are uploaded to Sentry and then deleted locally. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…sistent-with--20260122-214514
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@next.config.ts`:
- Line 26: sentryAuthToken is read at module init which happens before
dotenv.config() in nextConfigFactory, causing sourcemaps.disable to remain true
when token is provided via .env; move the process.env["SENTRY_AUTH_TOKEN"]
lookup into the export function (after calling dotenv.config()) so
sentryAuthToken is resolved at runtime inside nextConfigFactory (or the function
that runs dotenv.config()), and update any other top-level env reads around
lines referenced (e.g., the block controlling sourcemaps.disable and similar
reads at 139-145) to use the newly scoped variable so source-map uploads behave
correctly for local .env usage.
| import { sharedConfig } from "@/config/nextConfig"; | ||
| const require = createRequire(import.meta.url); | ||
| const sentryEnabled = Boolean(process.env["SENTRY_DSN"]); | ||
| const sentryAuthToken = process.env["SENTRY_AUTH_TOKEN"]; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if SENTRY_AUTH_TOKEN is configured in .env files
find . -name ".env*" -type f | head -20
echo "---"
# Search for SENTRY references in .env files
rg -n 'SENTRY_AUTH_TOKEN|SENTRY_DSN' --hidden || echo "No matches found"Repository: 6529-Collections/6529seize-frontend
Length of output: 991
🏁 Script executed:
#!/bin/bash
# Read next.config.ts to verify the exact structure and timing
wc -l next.config.ts
echo "---"
# Show the relevant sections
sed -n '1,50p' next.config.ts
echo "... [middle section] ..."
sed -n '26,26p' next.config.ts
echo "---"
sed -n '39,41p' next.config.ts
echo "---"
sed -n '135,150p' next.config.tsRepository: 6529-Collections/6529seize-frontend
Length of output: 2679
🏁 Script executed:
#!/bin/bash
# Check if SENTRY_AUTH_TOKEN is in the env schema
rg -n 'SENTRY_AUTH_TOKEN' config/env.schema.ts config/env.schema.runtime.cjs 2>/dev/null || echo "Not in schema"Repository: 6529-Collections/6529seize-frontend
Length of output: 92
🏁 Script executed:
#!/bin/bash
# Search for any documentation or comments about SENTRY_AUTH_TOKEN sourcing
rg -n -B2 -A2 'SENTRY_AUTH_TOKEN' next.config.ts | head -30Repository: 6529-Collections/6529seize-frontend
Length of output: 269
Capture SENTRY_AUTH_TOKEN after dotenv loads to support .env sourcing.
sentryAuthToken is read at module initialization (Line 26), but dotenv.config() runs later inside nextConfigFactory (Lines 39-41) for build/dev phases. This means if the token is provided via .env* files, sourcemaps.disable will incorrectly remain true, skipping source map uploads. While currently sourced from CI secrets, this limits flexibility for local development and creates a latent bug.
Consider moving the token lookup into the export function, after dotenv has run:
🔧 Suggested refactor
-const sentryAuthToken = process.env["SENTRY_AUTH_TOKEN"];
-const sentryWrappedConfig = withSentryConfig(nextConfigFactory, {
+const sentryConfigFactory = (sentryAuthToken?: string) =>
+ withSentryConfig(nextConfigFactory, {
// ...
sourcemaps: {
disable: !sentryAuthToken,
deleteSourcemapsAfterUpload: true,
},
- // ...
-});
+ // ...
+});
export default (phase: string): NextConfig => {
- if (!sentryEnabled) {
- return nextConfigFactory(phase);
- }
- return sentryWrappedConfig(phase);
+ const baseConfig = nextConfigFactory(phase);
+ if (!sentryEnabled) return baseConfig;
+ const sentryAuthToken = process.env["SENTRY_AUTH_TOKEN"];
+ const sentryWrappedConfig = sentryConfigFactory(sentryAuthToken);
+ return sentryWrappedConfig(phase);
};Also applies to: 139-145
🤖 Prompt for AI Agents
In `@next.config.ts` at line 26, sentryAuthToken is read at module init which
happens before dotenv.config() in nextConfigFactory, causing sourcemaps.disable
to remain true when token is provided via .env; move the
process.env["SENTRY_AUTH_TOKEN"] lookup into the export function (after calling
dotenv.config()) so sentryAuthToken is resolved at runtime inside
nextConfigFactory (or the function that runs dotenv.config()), and update any
other top-level env reads around lines referenced (e.g., the block controlling
sourcemaps.disable and similar reads at 139-145) to use the newly scoped
variable so source-map uploads behave correctly for local .env usage.



Automated change generated by
evoticketresolver.e6bf10e1-ec22-4445-8840-ba295358de46openaigpt-5.2-promainPrompt
Engine output (last message)
Generated at 2026-01-22 22:37:26Z.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.