Skip to content

Push notifications silently broken since knip dead-code removal (PR #7022) #7568

Description

Bug description

PR #7022 removed src/service-workers/index.ts and src/service-workers/firebase-messaging/firebase-messaging-sw.ts as dead code flagged by knip. However, these files were not part of the main app bundle's import graph — they were compiled separately by @ducanh2912/next-pwa via the customWorkerSrc option in next.config.mjs.

Without these files, public/firebase-messaging-sw.js remains empty (0 bytes) after build, so onBackgroundMessage is never registered and push notifications are silently dropped by the browser.

The remaining files in src/service-workers/firebase-messaging/ (notifications.ts, notification-mapper.ts, gateway-utils.ts, webhook-types.ts) are now effectively dead code since nothing imports them.

See: #7022 (comment)

Environment

  • Browser: Any (Chrome, Firefox)
  • Wallet: Any
  • Chain: Any

Steps to reproduce

  1. Build the app from main after PR #7022 was merged
  2. Check public/firebase-messaging-sw.js — it's 0 bytes
  3. Enable push notifications in the app
  4. Send a notification while the app is in the background

Expected result

Background push notifications are received and displayed.

Obtained result

Notifications are silently dropped. No error in console — the service worker is registered but has no code to handle incoming messages.

Today's date: 2026-07-31


🤖 Refined and Investigated by Claude — 2026-07-31

Session: Wallet Hygiene cloud routine, run 2026-07-31 (batch 4/6)

Labels added: Type → Bug, Tech → Frontend

Investigation notes:

  • Code: confirmed apps/web/next.config.mjs still configures customWorkerSrc: SERVICE_WORKERS_PATH and swSrc: '${SERVICE_WORKERS_PATH}/index.ts' pointing at ./src/service-workers, consistent with the report that push notifications depend on files under that path existing at build time. Several live files (apps/web/src/services/push-notifications/tracking.ts, preferences.ts, useNotificationTracking.ts, PushNotifications/index.tsx) still import @/service-workers/firebase-messaging/webhook-types — so that specific file is NOT dead code, contrary to the ticket's claim that all four remaining files are unused. Also found docs/solutions/tanstack-pwa-sri-20260602.md, which explicitly cites "Background push silently broken (regression Push notifications silently broken since knip dead-code removal (PR #7022) #7568) since knip removed the FCM worker (PR #7022)" and describes merging FCM handling into one worker for the new apps/web-tanstack app — this corroborates the regression is real and already known internally, with the fix so far scoped to the new Vite/tanstack app rather than the original Next.js apps/web this ticket is about.
  • Notion: not searched (code search already produced a strong, specific lead).
  • Datadog/Mixpanel: not applicable — no relevant funnel/monitor identified for this regression.
  • Unclear/missing: whether apps/web's original Next.js build has since been separately fixed, or whether the regression is still live in production for it — the internal doc only confirms the fix path for the new tanstack app.

Flagged for a human: (1) ticket has been in Triage status for ~120 days despite being a confirmed, reproducible regression with a named assignee (Daniel Dimitrov) — worth escalating out of Triage; (2) the ticket's claim that notifications.ts, notification-mapper.ts, gateway-utils.ts, and webhook-types.ts are all dead code is only partially accurate — webhook-types.ts is still actively imported — verify before treating the "cleanup remaining dead files" framing as accurate.

Auto-generated best-effort draft. Edit freely. React 👎 on this issue or ping to flag misses so I learn.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions