koala73/worldmonitor · warning

Web push is not supported in this browser.

Error message

Web push is not supported in this browser.

What it means

Thrown by subscribeToPush() in src/services/push-notifications.ts when isWebPushSupported() returns false. That gate fails when: running inside a Tauri webview (__TAURI_INTERNALS__/__TAURI__ markers), navigator.serviceWorker is missing, window.PushManager is missing, Notification is undefined, or the build lacks a VAPID key (VITE_VAPID_PUBLIC_KEY unset — treated as unsupported on purpose so the cryptic pushManager error is avoided). The intended UX is an 'Install the app first / unsupported' hint, not an error.

Source

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

  return fetch(path, {
    ...init,
    headers: {
      'Content-Type': 'application/json',
      ...(init.headers ?? {}),
      Authorization: `Bearer ${token}`,
    },
  });
}

/**
 * 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.

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Call isWebPushSupported() first and render a friendly 'not supported here — open in a regular browser / install the app' state.
  2. On iOS, instruct users to Add to Home Screen (iOS 16.4+) and retry from the installed PWA.
  3. If it fails everywhere including Chrome desktop, check that VITE_VAPID_PUBLIC_KEY was set at build time.
  4. For the desktop app, route notifications through the Tauri app's mechanism instead of web push.

Example fix

// before
await subscribeToPush(userId);

// after
import { isWebPushSupported } from '@/services/push-notifications';
if (!isWebPushSupported()) {
  showNotice('Push notifications are not supported in this browser. Open the app in a standard browser or install it.');
  return;
}
await subscribeToPush(userId);
Defensive patterns

Strategy: validation

Validate before calling

import { isWebPushSupported, getPushPermission } from '@/services/push-notifications';

if (!isWebPushSupported()) {
  renderUnsupportedNotice('Open the app in a standard browser, or install it on iOS 16.4+.');
  return;
}
await subscribeToPush(expectedUserId);

Type guard

function canAttemptWebPush(): boolean {
  return typeof window !== 'undefined'
    && 'serviceWorker' in navigator
    && 'PushManager' in window
    && typeof Notification !== 'undefined';
}

Try / catch

try {
  await subscribeToPush(expectedUserId);
} catch (err) {
  if (err instanceof Error && err.message === 'Web push is not supported in this browser.') {
    renderUnsupportedNotice(); // capability gap — no retry will help
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: iOS Safari without Add to-Home-Screen (and all pre-16.4 iOS); in-app browsers (Instagram, LinkedIn, Facebook WebViews) that omit PushManager; Tauri desktop webview; builds where VITE_VAPID_PUBLIC_KEY was not injected; very old browsers without service worker support.

Common situations: Mobile users opening the site from social-app browsers; desktop users on the Tauri build expecting web push; QA on preview builds compiled without the VAPID env var; older Safari versions.

Related errors


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