Skip to content

Conversation

@NaianFelix
Copy link

@NaianFelix NaianFelix commented Nov 3, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error logging for HTTP requests to improve troubleshooting and debugging capabilities.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

A debug logging statement was added to the fetchSafe function in utils/fetch.ts. When an HTTP response is neither OK nor a manual redirect, the input parameter is now logged to console.error before the HttpError is thrown. No control flow or behavioral changes.

Changes

Cohort / File(s) Summary
Error logging enhancement
utils/fetch.ts
Added console.error(input) log statement in the error path of fetchSafe before throwing HttpError for non-OK, non-redirect responses

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A console.error whispers near,
When the fetch goes wrong, the input's clear!
No flow has changed, just one log line,
Debugging now? Oh, how divine! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is completely missing. The template requires several key sections including 'What is this Contribution About?', 'Issue Link', 'Loom Video', and 'Demonstration Link'. None of these sections have been filled in, making it difficult for reviewers to understand the purpose, context, or testing approach for this change. Add a comprehensive pull request description following the provided template. Include a clear explanation of why the console.error logging was added, reference the related issue number, and provide any relevant links to demonstrate the fix. At minimum, fill in the 'What is this Contribution About?' and 'Issue Link' sections.
Title check ❓ Inconclusive The pull request title 'fix: filter log' is vague and does not clearly convey what was changed in the codebase. While it hints at fixing something related to filtering or logging, it lacks specificity about which component or functionality is affected. The title does not adequately reflect the actual change—adding console.error logging to the fetchSafe function when handling non-OK responses. Clarify the pull request title to be more specific and descriptive. For example, 'fix: add error logging to fetchSafe for failed responses' would better communicate the actual change and help reviewers understand the intent at a glance.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.130.3 update
  • 🎉 for Minor 0.131.0 update
  • 🚀 for Major 1.0.0 update

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99a42df and 699f815.

📒 Files selected for processing (1)
  • utils/fetch.ts (1 hunks)

if (isManual && isRedirect) {
return response;
}
console.error(input)
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

Logging raw URLs can expose PII and secrets.

The input parameter may contain sensitive data such as user identifiers (emails, user IDs) in the URL path or query parameters, as well as secrets (API keys, tokens, passwords) that should never be logged. This creates privacy violations (GDPR/CCPA) and security risks.

Consider one of these approaches:

Option 1: Add URL sanitization before logging

-  console.error(input)
+  const sanitizedUrl = typeof input === 'string' 
+    ? new URL(input).origin + new URL(input).pathname 
+    : input instanceof URL 
+    ? input.origin + input.pathname 
+    : input.url;
+  console.error('HTTP error for:', sanitizedUrl, 'Status:', response.status);

Option 2: Use structured logging with status code (no URL)

-  console.error(input)
+  console.error('HTTP request failed', { status: response.status, type: typeof input });

Also note: Missing semicolon at the end of line 50.

📝 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.

Suggested change
console.error(input)
const sanitizedUrl = typeof input === 'string'
? new URL(input).origin + new URL(input).pathname
: input instanceof URL
? input.origin + input.pathname
: input.url;
console.error('HTTP error for:', sanitizedUrl, 'Status:', response.status);
Suggested change
console.error(input)
console.error('HTTP request failed', { status: response.status, type: typeof input });
🤖 Prompt for AI Agents
In utils/fetch.ts around line 50, the code currently logs the raw `input` URL
which can expose PII or secrets and also is missing a semicolon; replace the raw
console.error(input) with a safe logging approach: either sanitize the URL
(strip query params and sensitive path segments like tokens/keys) before logging
or log only structured metadata (method, status code, hostname) without the full
URL, and ensure the statement ends with a semicolon; implement one sanitization
utility or structured log call and remove any direct printing of the full
`input`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant