Push: surface delivery failures (no longer a silent success) (#157)

A failed web push (e.g. VAPID key mismatch -> 401/403) was swallowed: /push/test still
returned 202 and the UI showed 'Sent', while the only trace was a journald WARNING.
Now: push.send logs failures to the errors JSONL (phase=push) so they show up like other
errors; /push/test returns a 'failed' count; and the 'Send test' button reports 'No
device' / 'Sent' / 'Failed' from the real result. Document the VAPID env vars (missing
from thermograph.env.example) and how to pin/diagnose them.
This commit is contained in:
Emi Griffith 2026-07-16 17:12:14 -07:00 committed by GitHub
parent 906d590529
commit dba45a1942

View file

@ -145,8 +145,16 @@ async function renderPushBar() {
btn.disabled = true;
const original = btn.textContent;
try {
await pushClient.sendTest();
const r = await pushClient.sendTest();
if (!r.devices) {
btn.textContent = "No device";
alert("No device is registered for push on this account. Turn alerts off and on again on this device to re-subscribe.");
} else if (r.sent > 0) {
btn.textContent = "Sent ✓";
} else {
btn.textContent = "Failed";
alert("The push service rejected delivery to this device. Turn alerts off and on again to re-subscribe; if it keeps failing, the server's push (VAPID) keys may have changed.");
}
} catch (err) {
alert(err.message || "Couldn't send a test notification.");
}