Refine Sentry initialization to only track production errors#628
Open
marcodejongh wants to merge 1 commit intomainfrom
Open
Refine Sentry initialization to only track production errors#628marcodejongh wants to merge 1 commit intomainfrom
marcodejongh wants to merge 1 commit intomainfrom
Conversation
- Add NODE_ENV check to server and edge configs to ensure Sentry is only enabled when both NODE_ENV and VERCEL_ENV are "production" - Change client hostname check from includes() to exact match to prevent errors from subdomains or similar domains https://claude.ai/code/session_013jBTzFjbJQFyfsDM5pT4t1
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Claude Review✅ Ready to merge - No significant issues found. The changes correctly tighten Sentry initialization to production-only by:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves Sentry error tracking configuration to ensure errors are only reported from production environments, preventing noise from local development and preview deployments.
Changes
includes("boardsesh.com")to exact match=== "boardsesh.com"to prevent false positives from subdomainsNODE_ENV === "production"check alongsideVERCEL_ENV === "production"to ensure both conditions are met before initializing SentryNODE_ENV === "production"check alongsideVERCEL_ENV === "production"to ensure both conditions are met before initializing SentryImplementation Details
The changes enforce stricter production environment detection across all three Sentry configuration entry points:
NODE_ENVandVERCEL_ENVto be set to "production", providing defense-in-depth against accidental error reporting from non-production environmentsThis prevents error pollution in Sentry from localhost development, preview deployments, and other non-production environments.
https://claude.ai/code/session_013jBTzFjbJQFyfsDM5pT4t1