From 795eef4bda5eb6d2cfbba1732d24bba980d7ca8e Mon Sep 17 00:00:00 2001 From: spinline Date: Fri, 13 Feb 2026 12:51:46 +0300 Subject: [PATCH] fix: refine push error matching and maximize webhook logging for debugging --- backend/src/push.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/src/push.rs b/backend/src/push.rs index 10a1840..99135b8 100644 --- a/backend/src/push.rs +++ b/backend/src/push.rs @@ -201,11 +201,18 @@ pub async fn send_push_notification( } } Err(e) => { - let err_msg = format!("{:?}", e); - tracing::error!("Failed to build push message for {}: {}", subscription.endpoint, err_msg); + let err_debug = format!("{:?}", e); + let err_display = format!("{}", e); + tracing::error!("Failed to build push message for {}: (Debug: {}) (Display: {})", subscription.endpoint, err_debug, err_display); + // Broaden error matching to catch various encryption and auth failures - if err_msg.contains("encrypting") || err_msg.contains("Vapid") || err_msg.contains("Unauthorized") { - tracing::warn!("Critical push error for subscriber {}, removing invalid subscription", subscription.endpoint); + let is_critical_error = err_debug.to_lowercase().contains("encrypt") + || err_debug.to_lowercase().contains("vapid") + || err_debug.to_lowercase().contains("unauthorized") + || err_debug.to_lowercase().contains("unknown error"); + + if is_critical_error { + tracing::warn!("Critical push error detected, removing invalid subscription: {}", subscription.endpoint); let _ = store.remove_subscription(&subscription.endpoint).await; } }