From 74c9ceefea3ce73ceab71b6e22ed675274cf0250 Mon Sep 17 00:00:00 2001 From: Riyadh Date: Sun, 17 May 2026 09:55:57 +0000 Subject: [PATCH] Fix VAPID subject fallback for push notifications Update push notification logic to correctly handle missing VAPID_SUBJECT environment variables by using logical OR operator instead of nullish coalescing for subject fallback. --- artifacts/api-server/src/lib/push.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/artifacts/api-server/src/lib/push.ts b/artifacts/api-server/src/lib/push.ts index d954818e..8f703296 100644 --- a/artifacts/api-server/src/lib/push.ts +++ b/artifacts/api-server/src/lib/push.ts @@ -38,9 +38,12 @@ async function loadVapid(): Promise<{ privateKey: string; subject: string; } | null> { + // Use `||` (not `??`) because docker-compose passes unset vars as + // empty strings, not undefined. An empty subject fails web-push's + // validateSubject() with "No subject set in vapidDetails.subject". const subject = - process.env.VAPID_SUBJECT ?? - `mailto:admin@${process.env.LOCAL_DOMAIN ?? "tx.local"}`; + process.env.VAPID_SUBJECT || + `mailto:admin@${process.env.LOCAL_DOMAIN || "tx.local"}`; const envPub = process.env.VAPID_PUBLIC_KEY; const envPriv = process.env.VAPID_PRIVATE_KEY;