Bolt integration

Firebase Push Notifications Failing in Bolt App

Your Bolt.new application is set up with Firebase Cloud Messaging (FCM) for push notifications, but users never receive them. The notification permission prompt may not appear, tokens fail to generate, or notifications are sent from the backend but never arrive on users' devices.

Push notifications are essential for user re-engagement: notifying users about new messages, order updates, price alerts, or time-sensitive events. When they don't work, your app loses its ability to bring users back, and you have to rely entirely on email which has much lower engagement rates.

Firebase push notifications involve multiple moving parts: a service worker on the client, a valid FCM token per device, proper Firebase configuration, and a server-side component that sends the actual notifications. Bolt's AI typically sets up some of these pieces but misses critical configuration steps.

Error Messages You Might See

FirebaseError: Messaging: A problem occurred while subscribing the user to FCM Error: Service worker registration failed FirebaseError: Messaging: The notification permission was not granted messaging/token-subscribe-failed FirebaseError: Messaging: We are unable to register the default service worker 403 SenderId mismatch
FirebaseError: Messaging: A problem occurred while subscribing the user to FCMError: Service worker registration failedFirebaseError: Messaging: The notification permission was not grantedmessaging/token-subscribe-failedFirebaseError: Messaging: We are unable to register the default service worker403 SenderId mismatch

Common Causes

  • Service worker not registered — Firebase requires a firebase-messaging-sw.js service worker file in the public root directory, which Bolt may not have created
  • Firebase config mismatch — The Firebase configuration in the app doesn't match the project in Firebase Console, so FCM can't authenticate
  • Notification permission not requested — The app never calls Notification.requestPermission(), so the browser blocks all notifications
  • FCM token not saved — The device token is generated but never sent to your backend for storage, so you can't target the user for notifications
  • VAPID key missing — The Voluntary Application Server Identification (VAPID) key is not configured, which is required for web push
  • Browser or OS blocking notifications — The user or their OS has disabled notifications globally, and your app doesn't detect or communicate this

How to Fix It

  1. Create the service worker file — Add firebase-messaging-sw.js to your public folder: importScripts('https://www.gstatic.com/firebasejs/10.7.0/firebase-app-compat.js', 'https://www.gstatic.com/firebasejs/10.7.0/firebase-messaging-compat.js'); firebase.initializeApp({...config}); firebase.messaging();
  2. Request permission properly — Ask for notification permission with context: show a UI explaining why notifications are useful before calling Notification.requestPermission()
  3. Generate and save FCM token — After permission is granted: const token = await getToken(messaging, { vapidKey: process.env.NEXT_PUBLIC_FIREBASE_VAPID_KEY }); await saveTokenToBackend(token, userId);
  4. Configure VAPID key — In Firebase Console > Project Settings > Cloud Messaging, generate a Web Push certificate key pair and use the public key as your VAPID key
  5. Send from backend with Admin SDK — Use Firebase Admin SDK on the server: admin.messaging().send({ token: userFcmToken, notification: { title: 'New message', body: 'You have a new message' } })
  6. Handle token refresh — FCM tokens expire and refresh. Listen for token changes: onMessage(messaging, (payload) => handleForegroundMessage(payload))

Real developers can help you.

BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Dor Yaloz Dor Yaloz SW engineer with 6+ years of experience, I worked with React/Node/Python did projects with React+Capacitor.js for ios Supabase expert Jared Hasson Jared Hasson Full time lead founding dev at a cyber security saas startup, with 10 yoe and a bachelor's in CS. Building & debugging software products is what I've spent my time on for forever Matthew Jordan Matthew Jordan I've been working at a large software company named Kainos for 2 years, and mainly specialise in Platform Engineering. I regularly enjoy working on software products outside of work, and I'm a huge fan of game development using Unity. I personally enjoy Python & C# in my spare time, but I also specialise in multiple different platform-related technologies from my day job. Jen Jacobsen Jen Jacobsen I’m a Full-Stack Developer with over 10 years of experience building modern web and mobile applications. I enjoy working across the full product lifecycle — turning ideas into real, well-built products that are intuitive for users and scalable for businesses. I particularly enjoy building mobile apps, modern web platforms, and solving complex technical problems in a way that keeps systems clean, reliable, and easy to maintain. Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services Stanislav Prigodich Stanislav Prigodich 15+ years building iOS and web apps at startups and enterprise companies. I want to use that experience to help builders ship real products - when something breaks, I'm here to fix it. Nam Tran Nam Tran 10 years as fullstack developer

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Do Firebase push notifications work on iOS Safari?

Yes, but only since iOS 16.4 and only for apps added to the Home Screen (PWA). Standard Safari doesn't support Web Push. For full iOS support, you need a native app wrapper or use a service like OneSignal that handles the complexity.

Why do notifications work in development but not in production?

Common causes: the firebase-messaging-sw.js file isn't in the production build output, the VAPID key is different between environments, or the Firebase project used in development differs from production. Verify all Firebase config values match your production Firebase project.

Related Bolt Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help