koala73/worldmonitor · error

Notifications permission was not granted.

Error message

Notifications permission was not granted.

What it means

UI error in subscribeToPush: Notification.requestPermission() completed without 'granted' — the user denied or dismissed the browser permission prompt. The subscription flow deliberately stops because a push subscription is unusable without permission.

Source

Thrown at src/services/push-notifications.ts:141

 * Ask permission (if needed), subscribe via pushManager, and register
 * the endpoint with the server. Resolves with the payload the server
 * accepted, or throws on cancel / denial / network failure.
 */
export async function subscribeToPush(expectedUserId?: string): Promise<SubscriptionPayload> {
  assertExpectedAccount(expectedUserId);
  if (!isWebPushSupported()) {
    throw new Error('Web push is not supported in this browser.');
  }
  const reg = await getRegistration();
  if (!reg) throw new Error('Service worker unavailable.');

  const perm = await Notification.requestPermission();
  if (perm !== 'granted') {
    throw new Error(
      perm === 'denied'
        ? 'Notifications are blocked. Enable them in your browser settings to continue.'
        : 'Notifications permission was not granted.',
    );
  }

  // Re-use an existing subscription if pushManager already has one
  // for this origin. Re-registering via POST keeps server state in
  // sync even when the browser has a stale subscription — this is
  // important after sign-out/sign-in, where the browser's push
  // identity persists but the Convex row does not.
  let sub = await reg.pushManager.getSubscription();
  if (!sub) {
    sub = await reg.pushManager.subscribe({
      userVisibleOnly: true,
      applicationServerKey: urlBase64ToUint8Array(VAPID_PUBLIC_KEY) as BufferSource,
    });
  }

  const payload = subscriptionToPayload(sub);
  if (!payload) {
    // Chrome occasionally hands back a subscription with null keys on

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Re-enable notifications in the browser's site settings and retry
  2. Follow the browser's flow to undo a denial (usually via the permissions icon in the address bar)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/services/push-notifications.ts:141 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21). Data as JSON: /api/errors/671bd8366cd399dd. Report an issue: GitHub.