Skip to content

Conversation

@KyleTryon
Copy link
Contributor

This pull request adds comprehensive Sentry debug logging and diagnostics across both backend (cloudflare.ts, hono/app.ts) and frontend (main.tsx) code, making it easier to verify Sentry configuration, initialization, and runtime status in all environments. Logging is now always enabled (not just in development), and diagnostic endpoints and test messages are included to confirm Sentry is working as expected.

Sentry Debug Logging and Diagnostics

Backend (cloudflare.ts, hono/app.ts):

  • Added detailed debug logs to Sentry initialization and configuration in cloudflare.ts, including checks for DSN existence, length, and available environment keys. Logging now uses console.error for missing DSN and is always enabled. [1] [2]
  • Enhanced HTTP middleware in hono/app.ts to log Sentry status and span creation for every request, with warnings if Sentry is not configured.
  • Improved /debug-sentry endpoint to provide comprehensive diagnostics, including runtime info, DSN details, available Sentry methods, environment keys, and attempts to send test errors and logs to Sentry, with robust error handling.

Frontend (main.tsx):

  • Added always-on debug logs for Sentry DSN status, type, length, and all VITE env keys before initialization. Sentry configuration is logged in detail regardless of environment.
  • Sentry initialization and test message sending are now logged in all environments, not just development. Errors in initialization or test message sending are logged as well.

KyleTryon and others added 5 commits January 12, 2026 14:43
Add extensive logging to diagnose why Sentry traces aren't being collected:

- Log Sentry initialization in withSentry callback (always, not just dev)
- Log HTTP tracing middleware execution for every request
- Enhanced /debug-sentry endpoint with full diagnostics
- Log DSN presence, length, and configuration status
- Log available Sentry methods and environment keys

This will help identify if:
1. SENTRY_DSN environment variable is missing
2. Sentry SDK is not initializing
3. HTTP tracing middleware is not running
4. startSpan function is not available

Debug logs are prefixed with [SENTRY DEBUG] for easy filtering.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Add extensive logging to diagnose Sentry initialization issues:
- Log DSN validation steps (existence, type, length)
- Log all VITE_ environment variables
- Log full Sentry configuration (temporarily including full DSN)
- Send test message and log event ID
- ALWAYS log (not just in development mode)

This will help identify if VITE_SENTRY_DSN is missing or invalid.
- Use Record<string, unknown> type for safer property access
- Remove unnecessary logger test code that caused type issues
@KyleTryon
Copy link
Contributor Author

@sentry review

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.

2 participants