@@ -175,22 +175,67 @@ export function createHonoApp(config: HonoAppConfig) {
175175 return c . json ( { status : "ok" , runtime : c . get ( "runtime" ) } ) ;
176176 } ) ;
177177
178- // Debug Sentry
178+ // Debug Sentry - comprehensive diagnostics
179179 app . get ( "/debug-sentry" , ( c ) => {
180180 const env = c . get ( "env" ) ;
181181 const sentry = c . get ( "sentry" ) ;
182182 const runtime = c . get ( "runtime" ) ;
183183
184+ const diagnostics = {
185+ runtime,
186+ sentryConfigured : ! ! env . SENTRY_DSN ,
187+ sentryDsnLength : env . SENTRY_DSN ?. length || 0 ,
188+ sentryDsnPrefix : env . SENTRY_DSN ?. substring ( 0 , 20 ) || "not set" ,
189+ sentryExists : ! ! sentry ,
190+ sentryMethods : sentry
191+ ? Object . keys ( sentry )
192+ . filter (
193+ ( k ) =>
194+ typeof ( sentry as Record < string , unknown > ) [ k ] === "function"
195+ )
196+ . slice ( 0 , 10 )
197+ : [ ] ,
198+ environment : env . SENTRY_ENVIRONMENT || env . NODE_ENV || "unknown" ,
199+ allEnvKeys : Object . keys ( env ) . filter (
200+ ( k ) => ! k . includes ( "SECRET" ) && ! k . includes ( "KEY" )
201+ ) ,
202+ } ;
203+
184204 if ( ! env . SENTRY_DSN ) {
185- return c . json ( { message : "Sentry not configured" } ) ;
205+ return c . json ( {
206+ status : "error" ,
207+ message : "Sentry DSN not configured" ,
208+ diagnostics,
209+ } ) ;
186210 }
187211
188- const testError = new Error ( "Test Sentry error!" ) ;
189- const eventId = sentry . captureException ( testError , {
190- tags : { test : "debug-sentry" , runtime } ,
191- } ) ;
212+ // Try to capture an exception
213+ try {
214+ const testError = new Error ( "Test Sentry error from debug endpoint!" ) ;
215+ const eventId = sentry . captureException ( testError , {
216+ tags : { test : "debug-sentry" , runtime } ,
217+ } ) ;
192218
193- return c . json ( { error : "Test error" , eventId, runtime } , 500 ) ;
219+ return c . json (
220+ {
221+ status : "success" ,
222+ message : "Test error and log sent to Sentry" ,
223+ eventId,
224+ diagnostics,
225+ } ,
226+ 500
227+ ) ;
228+ } catch ( error ) {
229+ return c . json (
230+ {
231+ status : "error" ,
232+ message : "Failed to send test error" ,
233+ error : error instanceof Error ? error . message : String ( error ) ,
234+ diagnostics,
235+ } ,
236+ 500
237+ ) ;
238+ }
194239 } ) ;
195240
196241 // BetterAuth routes
0 commit comments