fix(push): serve the VAPID key at runtime via @profullstack/notifications - #121
Merged
Merged
Conversation
…ions "Push notifications are not supported in this browser" showed everywhere because NEXT_PUBLIC_VAPID_PUBLIC_KEY is not a Docker build ARG, so it was inlined as '' in the client and the server's initWebPush was silently disabled too. - GET /api/push/vapid-public-key serves the key from the runtime env - usePushNotifications uses the package client (pushSupport, subscribe, unsubscribe) and surfaces the real reason push is unavailable - lib/push.ts sends with the package server (sendPush, vapidKeysFromEnv); drops web-push Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan47 finding(s) HIGH/CRITICAL: 4 | MEDIUM: 27 | LOW: 16
Snippets are redacted; ThreatCrush never prints matched credential material. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every browser showed "Push notifications are not supported in this browser." The client decided support from
NEXT_PUBLIC_VAPID_PUBLIC_KEY, which Next inlines at build time. The Docker build never received it, so it compiled to''. The same inlining silently disabled server-side sending ininitWebPush.What
GET /api/push/vapid-public-keyserves the key from the runtime env (503 when unset).usePushNotificationsnow uses@profullstack/notifications/client. Support detection gives a specific reason: iOS needs Home Screen install, insecure context, denied, and so on. The settings page shows that reason instead of a generic "not supported".lib/push.tssends via@profullstack/notifications/server(sendPush+vapidKeysFromEnv). Stale 404/410 subscriptions are still pruned.web-pushhas been removed.Tests: 994/994 web tests pass; typecheck and prettier are clean.
🤖 Generated with Claude Code