fix: handle Docker build placeholder env vars in Supabase clients and VAPID init

Docker builds use __NEXT_PUBLIC_*__ sentinel values that get replaced at
runtime by docker-entrypoint.sh. These placeholders caused build failures:
- Supabase client constructor rejected invalid URL during page prerendering
- web-push VAPID init rejected invalid key format

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-03-03 14:50:46 +01:00
co-authored by Claude Opus 4.6
parent b5b004509d
commit 3909f23725
3 changed files with 26 additions and 6 deletions
@@ -18,7 +18,11 @@ const vapidPublicKey = process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY
const vapidPrivateKey = process.env.VAPID_PRIVATE_KEY
const vapidSubject = process.env.VAPID_SUBJECT || 'mailto:support@erp-base.se'
if (vapidPublicKey && vapidPrivateKey) {
if (
vapidPublicKey &&
vapidPrivateKey &&
!vapidPublicKey.startsWith('__')
) {
webpush.setVapidDetails(vapidSubject, vapidPublicKey, vapidPrivateKey)
}