Skip to content

feat: added bugmail for simple error tracking#63

Open
MarcorpAI wants to merge 2 commits into
michaelshimeles:mainfrom
MarcorpAI:integrated-bugmail
Open

feat: added bugmail for simple error tracking#63
MarcorpAI wants to merge 2 commits into
michaelshimeles:mainfrom
MarcorpAI:integrated-bugmail

Conversation

@MarcorpAI

@MarcorpAI MarcorpAI commented Dec 8, 2025

Copy link
Copy Markdown

User description

Added Bugmail integration as a simpler alternative to PostHog for error tracking.
Bugmail uses a Gmail-style inbox approach - ideal for developers who want straightforward bug reports without complex configuration. NO config hell, no bloated dashboards, just get emailed when stuff breaks in production (30 seconds setup).
Changes:

Added optional Bugmail SDK setup
Configured via NEXT_PUBLIC_BUGMAIL_API_KEY and NEXT_PUBLIC_BUGMAIL_PROJECT_ID environment variable
Updated README with setup instructions
Zero impact if not configured (existing postHog setup unchanged)


PR Type

Enhancement


Description

  • Added BugMail integration for simple email-based error tracking

  • Implemented SafeBugMailProvider wrapper for optional, zero-config setup

  • Created error boundary component to capture and report exceptions

  • Updated documentation with BugMail setup instructions and environment variables


Diagram Walkthrough

flowchart LR
  A["Environment Variables"] -->|"API Key & Project ID"| B["SafeBugMailProvider"]
  B -->|"Conditional Wrapping"| C["Root Layout"]
  C --> D["Error Boundary"]
  D -->|"captureException"| E["BugMail Service"]
  F["Documentation"] -->|"Setup Guide"| E
Loading

File Walkthrough

Relevant files
Configuration changes
.env.example
Add BugMail environment variables                                               

.env.example

  • Added NEXT_PUBLIC_BUGMAIL_API_KEY environment variable
  • Added NEXT_PUBLIC_BUGMAIL_PROJECT_ID environment variable
  • Included comment with BugMail documentation link
+6/-1     
Documentation
README.md
Document BugMail setup and features                                           

README.md

  • Added BugMail to Analytics & Monitoring section
  • Added BugMail to tech stack as optional error tracking
  • Created comprehensive BugMail setup guide with 4-step instructions
  • Updated Analytics & Tracking section with BugMail details
+22/-1   
Enhancement
error.tsx
Create error boundary with BugMail integration                     

app/error.tsx

  • Created new error boundary component for client-side errors
  • Integrated useBugMail hook to capture exceptions
  • Implemented fallback console logging if BugMail unavailable
  • Added user-friendly error UI with reset button
+35/-0   
layout.tsx
Wrap layout with BugMail provider                                               

app/layout.tsx

  • Imported SafeBugMailProvider component
  • Wrapped children with SafeBugMailProvider in root layout
  • Maintains existing ThemeProvider and Analytics setup
+4/-1     
bugmail-provider.tsx
Implement conditional BugMail provider wrapper                     

components/bugmail-provider.tsx

  • Created SafeBugMailProvider wrapper component
  • Implements conditional rendering based on environment variables
  • Returns children directly if BugMail not configured (no-op)
  • Wraps with BugMailProvider when credentials are present
+24/-0   
Dependencies
package.json
Add BugMail JavaScript SDK dependency                                       

package.json

  • Added @bugmail-js/next dependency version ^0.1.2
+1/-0     

@vercel

vercel Bot commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

@MarcorpAI is attempting to deploy a commit to the Goshen Labs Team on Vercel.

A member of the Team first needs to authorize it.

@qodo-code-review

qodo-code-review Bot commented Dec 8, 2025

Copy link
Copy Markdown

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Hard-coded external endpoint

Description: The BugMail provider is configured with a hard-coded API endpoint
('https://api.bugmail.site'); if this library sends sensitive error details (stack traces,
user context) from the client, forcing a fixed external endpoint reduces control over
egress and CSP pinning and may violate data residency/compliance—make the endpoint
configurable via environment variable and document data sent.
bugmail-provider.tsx [16-20]

Referred Code
<BugMailProvider
    apiKey={apiKey}
    projectId={projectId}
    endpoint="https://api.bugmail.site"
>
Error detail exposure

Description: Client-side error handler captures exceptions and logs the full error to console in
production, which can leak stack traces and potentially sensitive details to end users and
browser logs; gate console logging behind a development check or strip messages in
production.
error.tsx [15-22]

Referred Code
useEffect(() => {
    // Only report if BugMail is configured (provider will handle the check)
    if (bugmail) {
        bugmail.captureException(error);
    }
    // Fallback: Log to console
    console.error(error);
}, [error, bugmail]);
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
Missing audit logs: The new error handling reports exceptions to BugMail but does not add or reference any
audit trail for critical actions, which may be acceptable if out of scope but is not
verifiable from this diff.

Referred Code
useEffect(() => {
    // Only report if BugMail is configured (provider will handle the check)
    if (bugmail) {
        bugmail.captureException(error);
    }
    // Fallback: Log to console
    console.error(error);
}, [error, bugmail]);

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Limited context: Errors are captured and logged, but no additional actionable context (user/session, route,
custom metadata) is attached to the BugMail report, which may limit debugging
effectiveness.

Referred Code
useEffect(() => {
    // Only report if BugMail is configured (provider will handle the check)
    if (bugmail) {
        bugmail.captureException(error);
    }

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status:
Console logging: The fallback console.error may log full Error objects including stack traces that could
contain sensitive details if executed in production.

Referred Code
    // Fallback: Log to console
    console.error(error);
}, [error, bugmail]);

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review

qodo-code-review Bot commented Dec 8, 2025

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Prevent duplicate error logging
Suggestion Impact:The commit moved the console.error(error) call into an else block so it only runs when bugmail is falsy, eliminating redundant logging when BugMail captures the exception.

code diff:

         if (bugmail) {
             bugmail.captureException(error);
+        } else {
+            // Fallback: Log to console if BugMail is not configured
+            console.error(error);
         }
-        // Fallback: Log to console
-        console.error(error);

To prevent redundant error logging, move console.error(error) into an else block
so it only executes as a fallback when BugMail is not configured.

app/error.tsx [17-21]

 if (bugmail) {
     bugmail.captureException(error);
+} else {
+    // Fallback: Log to console if BugMail is not configured
+    console.error(error);
 }
-// Fallback: Log to console
-console.error(error);

[Suggestion processed]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a logical flaw where errors are always logged to the console, creating redundancy, and proposes a fix that aligns the code with its documented intent to use console.error as a fallback.

Medium
  • Update

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant