From 83feb5a5cfc0107fa4392758d4ae1ee421052667 Mon Sep 17 00:00:00 2001 From: spinline Date: Fri, 13 Feb 2026 12:41:11 +0300 Subject: [PATCH] fix: broaden push notification error handling to clear invalid subscriptions more effectively --- backend/src/push.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/src/push.rs b/backend/src/push.rs index 9aa19f9..10a1840 100644 --- a/backend/src/push.rs +++ b/backend/src/push.rs @@ -201,10 +201,11 @@ pub async fn send_push_notification( } } Err(e) => { - tracing::error!("Failed to build push message: {}", e); - // Specific handling for encryption errors - often means invalid keys - if format!("{:?}", e).contains("encrypting") { - tracing::warn!("Encryption error for subscriber {}, removing suspect subscription", subscription.endpoint); + let err_msg = format!("{:?}", e); + tracing::error!("Failed to build push message for {}: {}", subscription.endpoint, err_msg); + // 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 _ = store.remove_subscription(&subscription.endpoint).await; } }