diff --git a/lib/webPush.js b/lib/webPush.js index 4a460681..c4daa44a 100644 --- a/lib/webPush.js +++ b/lib/webPush.js @@ -85,6 +85,9 @@ const sendNotification = (subscription, payload) => { async function sendUserNotification (userId, notification) { try { + if (!userId) { + throw new Error('user id is required') + } notification.data ??= {} if (notification.item) { notification.data.url ??= await createItemUrl(notification.item)