docs(sentry): document false-positive warnings and add troubleshooting guide#935
docs(sentry): document false-positive warnings and add troubleshooting guide#935
Conversation
…g guide ## Summary - Document Sentry configuration warnings that appear in development logs - Add comprehensive troubleshooting guide explaining each warning - Update .env.example with detailed explanation of warning suppressions ## Changes - **SENTRY_WARNINGS.md**: New troubleshooting guide explaining all Sentry warnings - **.env.example**: Enhanced documentation for SENTRY_SUPPRESS_GLOBAL_ERROR_HANDLER_FILE_WARNING ## Rationale Development logs show three Sentry warnings that are actually false positives: 1. "onRequestError hook not found" - Hook IS properly configured in instrumentation.ts:17 2. "No global-error.js file" - global-error.tsx EXISTS at src/app/global-error.tsx 3. "Rename sentry.client.config.ts" - Already using instrumentation-client.ts These warnings cause confusion but don't affect functionality. This PR provides clear documentation to explain why they occur and confirms all Sentry features work correctly. ## Impact - ✅ Reduces developer confusion about Sentry warnings - ✅ Provides clear reference documentation - ✅ No code changes - documentation only - ✅ No impact on runtime behavior or error tracking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughUpdates Sentry warning documentation in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@SENTRY_WARNINGS.md`:
- Around line 10-14: Add language identifiers to the fenced code blocks
containing Sentry warnings (e.g., the blocks starting with "[`@sentry/nextjs`]
Could not find `onRequestError` hook", "[`@sentry/nextjs`] It seems like you don't
have a global error handler set up.", and "[`@sentry/nextjs`] DEPRECATION WARNING:
It is recommended renaming your `sentry.client.config.ts` file") by changing
their opening fences to include a language tag such as "text" (for example, use
```text) so markdownlint stops flagging missing language tags; apply the same
change to the other reported blocks (lines with the same three warning strings
referenced in the comment).
- Around line 150-154: The markdown table in SENTRY_WARNINGS.md violates MD060
because the pipes lack surrounding spaces; update the header row "Warning |
Status | Action Required" and each data row containing "`onRequestError` hook
not found", "No `global-error.js` file", and "Rename `sentry.client.config.ts`"
so that every pipe character has a single space on both sides (e.g., " | ")
throughout the table to satisfy markdownlint MD060.
| ``` | ||
| [@sentry/nextjs] Could not find `onRequestError` hook in instrumentation file. | ||
| This indicates outdated configuration of the Sentry SDK. | ||
| Use `Sentry.captureRequestError` to instrument the `onRequestError` hook. | ||
| ``` |
There was a problem hiding this comment.
Add language identifiers to fenced code blocks.
Markdownlint flags these blocks for missing language tags; add appropriate identifiers (e.g., text) to keep lint clean.
🔧 Suggested fix
-```
+```text
[`@sentry/nextjs`] Could not find `onRequestError` hook in instrumentation file.
This indicates outdated configuration of the Sentry SDK.
Use `Sentry.captureRequestError` to instrument the `onRequestError` hook.
```diff
-```
+```text
[`@sentry/nextjs`] It seems like you don't have a global error handler set up.
It is recommended that you add a 'global-error.js' file with Sentry instrumentation.
(you can suppress this warning by setting SENTRY_SUPPRESS_GLOBAL_ERROR_HANDLER_FILE_WARNING=1)
```diff
-```
+```text
[`@sentry/nextjs`] DEPRECATION WARNING: It is recommended renaming your `sentry.client.config.ts` file,
or moving its content to `instrumentation-client.ts`.
When using Turbopack `sentry.client.config.ts` will no longer work.
</details>
Also applies to: 42-46, 82-86
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 markdownlint-cli2 (0.20.0)</summary>
10-10: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
In @SENTRY_WARNINGS.md around lines 10 - 14, Add language identifiers to the
fenced code blocks containing Sentry warnings (e.g., the blocks starting with
"[@sentry/nextjs] Could not find onRequestError hook", "[@sentry/nextjs] It
seems like you don't have a global error handler set up.", and "[@sentry/nextjs]
DEPRECATION WARNING: It is recommended renaming your sentry.client.config.ts
file") by changing their opening fences to include a language tag such as "text"
(for example, use ```text) so markdownlint stops flagging missing language tags;
apply the same change to the other reported blocks (lines with the same three
warning strings referenced in the comment).
</details>
<!-- fingerprinting:phantom:triton:eagle -->
<!-- This is an auto-generated comment by CodeRabbit -->
| | Warning | Status | Action Required | | ||
| |---------|--------|-----------------| | ||
| | `onRequestError` hook not found | ❌ False Positive | ✅ Already implemented in `instrumentation.ts:17` | | ||
| | No `global-error.js` file | ❌ False Positive | ✅ Implemented as `global-error.tsx` | | ||
| | Rename `sentry.client.config.ts` | ❌ False Positive | ✅ Already using `instrumentation-client.ts` | |
There was a problem hiding this comment.
Fix table pipe spacing for markdownlint MD060.
The summary table needs spaces around pipes to satisfy the configured style.
🔧 Suggested fix
-| Warning | Status | Action Required |
-|---------|--------|-----------------|
-| `onRequestError` hook not found | ❌ False Positive | ✅ Already implemented in `instrumentation.ts:17` |
-| No `global-error.js` file | ❌ False Positive | ✅ Implemented as `global-error.tsx` |
-| Rename `sentry.client.config.ts` | ❌ False Positive | ✅ Already using `instrumentation-client.ts` |
+| Warning | Status | Action Required |
+| --- | --- | --- |
+| `onRequestError` hook not found | ❌ False Positive | ✅ Already implemented in `instrumentation.ts:17` |
+| No `global-error.js` file | ❌ False Positive | ✅ Implemented as `global-error.tsx` |
+| Rename `sentry.client.config.ts` | ❌ False Positive | ✅ Already using `instrumentation-client.ts` |📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| | Warning | Status | Action Required | | |
| |---------|--------|-----------------| | |
| | `onRequestError` hook not found | ❌ False Positive | ✅ Already implemented in `instrumentation.ts:17` | | |
| | No `global-error.js` file | ❌ False Positive | ✅ Implemented as `global-error.tsx` | | |
| | Rename `sentry.client.config.ts` | ❌ False Positive | ✅ Already using `instrumentation-client.ts` | | |
| | Warning | Status | Action Required | | |
| | --- | --- | --- | | |
| | `onRequestError` hook not found | ❌ False Positive | ✅ Already implemented in `instrumentation.ts:17` | | |
| | No `global-error.js` file | ❌ False Positive | ✅ Implemented as `global-error.tsx` | | |
| | Rename `sentry.client.config.ts` | ❌ False Positive | ✅ Already using `instrumentation-client.ts` | |
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)
151-151: Table column style
Table pipe is missing space to the right for style "compact"
(MD060, table-column-style)
151-151: Table column style
Table pipe is missing space to the left for style "compact"
(MD060, table-column-style)
151-151: Table column style
Table pipe is missing space to the right for style "compact"
(MD060, table-column-style)
151-151: Table column style
Table pipe is missing space to the left for style "compact"
(MD060, table-column-style)
151-151: Table column style
Table pipe is missing space to the right for style "compact"
(MD060, table-column-style)
151-151: Table column style
Table pipe is missing space to the left for style "compact"
(MD060, table-column-style)
🤖 Prompt for AI Agents
In `@SENTRY_WARNINGS.md` around lines 150 - 154, The markdown table in
SENTRY_WARNINGS.md violates MD060 because the pipes lack surrounding spaces;
update the header row "Warning | Status | Action Required" and each data row
containing "`onRequestError` hook not found", "No `global-error.js` file", and
"Rename `sentry.client.config.ts`" so that every pipe character has a single
space on both sides (e.g., " | ") throughout the table to satisfy markdownlint
MD060.
| **Location**: `instrumentation.ts:17` | ||
| ```typescript | ||
| export const onRequestError = Sentry.captureRequestError; |
There was a problem hiding this comment.
line reference mentions instrumentation.ts:17, but consider removing specific line numbers from documentation as they can become outdated if the file changes. "exports onRequestError correctly" would be more maintainable
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: SENTRY_WARNINGS.md
Line: 21:23
Comment:
line reference mentions `instrumentation.ts:17`, but consider removing specific line numbers from documentation as they can become outdated if the file changes. "exports `onRequestError` correctly" would be more maintainable
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
Summary
Changes
SENTRY_SUPPRESS_GLOBAL_ERROR_HANDLER_FILE_WARNINGBackground
Development logs show three Sentry warnings that are actually false positives:
1. "onRequestError hook not found"
Status: ❌ False Positive
Reality: Hook IS properly configured in
instrumentation.ts:17:2. "No global-error.js file"
Status: ❌ False Positive
Reality:
global-error.tsxEXISTS atsrc/app/global-error.tsxCause: Sentry's check looks for
.jsbut doesn't recognize.tsxfiles3. "Rename sentry.client.config.ts"
Status: ❌ False Positive
Reality: Already using
instrumentation-client.ts(the recommended approach)Rationale
These warnings cause confusion for developers but don't affect functionality. All Sentry features are working correctly:
onRequestErrorhookThis PR provides clear documentation to:
Test Plan
Impact
Related
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.
Greptile Overview
Greptile Summary
This PR adds comprehensive documentation for three Sentry warnings that appear during development but are false positives. The warnings occur due to detection limitations in
@sentry/nextjs- specifically timing issues withonRequestErrorhook detection, file extension mismatches forglobal-error.tsx, and overly broad deprecation warnings.Key improvements:
SENTRY_WARNINGS.mdproviding detailed explanations of each warning, why they appear, and verification steps.env.examplewith clear multi-line documentation explaining both warning typesonRequestErrorhook exists atinstrumentation.ts:17,global-error.tsxis properly implemented with Sentry integration, andinstrumentation-client.tsis correctly used instead of deprecated configImpact:
This documentation-only change reduces developer confusion without affecting runtime behavior or error tracking functionality.
Confidence Score: 5/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant Dev as Developer participant Build as Build Process participant Sentry as @sentry/nextjs participant Files as Codebase Files participant Logs as Dev Logs Dev->>Build: Run development server Build->>Sentry: Initialize Sentry SDK Note over Sentry,Files: Warning 1: onRequestError Hook Sentry->>Files: Check for onRequestError hook Note right of Sentry: Check happens during startup<br/>before instrumentation.ts loads Sentry->>Logs: ⚠️ "onRequestError hook not found" Note over Files: Actually exists at<br/>instrumentation.ts:17 Note over Sentry,Files: Warning 2: Global Error File Sentry->>Files: Look for global-error.js Files-->>Sentry: File not found (.js) Note right of Files: global-error.tsx exists<br/>but Sentry only checks .js Sentry->>Logs: ⚠️ "No global-error.js file" Note over Sentry,Files: Warning 3: Config Deprecation Sentry->>Files: Check for deprecated config Files-->>Sentry: sentry.client.config.ts not found Note right of Files: Already using<br/>instrumentation-client.ts Sentry->>Logs: ⚠️ "Rename sentry.client.config.ts" Note over Sentry: Shown globally even if<br/>not using old approach Dev->>Logs: View warnings Dev->>Files: Read SENTRY_WARNINGS.md Note over Dev: Understands warnings<br/>are false positives Note over Dev,Files: Runtime Behavior Files->>Sentry: Errors captured correctly Sentry->>Sentry: All features working ✓