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.

MFox MFox Full-stack professional senior engineer (15+years). Extensive experience in software development, qa, and IP networking. 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 Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Milan Surelia Milan Surelia Milan Surelia is a Mobile App Developer with 5+ years of experience crafting scalable, cross-platform apps at 7Span and Meticha. At 7Span, he engineers feature-rich Flutter apps with smooth performance and modern UI. As the Co-Founder of Meticha, he builds open-source tools and developer-focused products that solve real-world problems. Expertise: 💡 Developing cross-platform apps using Flutter, Dart, and Jetpack Compose for Android, iOS, and Web. 🖋️ Sharing insights through technical writing, blogging, and open-source contributions. 🤝 Collaborating closely with designers, PMs, and developers to build seamless mobile experiences. Notable Achievements: 🎯 Revamped the Vepaar app into Vepaar Store & CRM with a 2x performance boost and smoother UX. 🚀 Launched Compose101 — a Jetpack Compose starter kit to speed up Android development. 🌟 Open source contributions on Github & StackOverflow for Flutter & Dart 🎖️ Worked on improving app performance and user experience with smart solutions. Milan is always happy to connect, work on new ideas, and explore the latest in technology. Yovel Cohen Yovel Cohen I got a lot of experience in building Long-horizon AI Agents in production, Backend apps that scale to millions of users and frontend knowledge as well. 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. Bastien Labelle Bastien Labelle Full stack dev w/ 20+ years of experience Costea Adrian Costea Adrian Embedded Engineer specilizing in perception systems. Latest project was a adas camera calibration system. Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups

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