Skip to content

Cloud Messaging doesn't work in Firefox for Android #5165

Open
@danieloliveira117

Description

@danieloliveira117

Describe your environment

  • Operating System version: Android 11
  • Browser version: Firefox for Android 90.1.1
  • Firebase SDK version: 8.7.1
  • Firebase Product: Cloud Messaging

Describe the problem

In Firefox for Android when trying to get the messaging token it crashes with the following error:
image

The same code is functional in Chrome (Android, Windows, Ubuntu), Firefox (Windows, Ubuntu) and Edge (Windows).

Steps to reproduce:

  1. Attempt to get messaging token in Firefox for Android.

Relevant Code:

Main app:

const firebaseApp = firebase.initializeApp({...});
const messaging = firebaseApp.messaging();
const currentToken = await messaging.getToken({
	vapidKey: '...',
});

firebase-messaging-sw.js:

importScripts('https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/8.6.1/firebase-messaging.js');

firebase.initializeApp({...});

const messaging = firebase.messaging();
messaging.onBackgroundMessage((payload) => {
    console.log(
        '[firebase-messaging-sw.js] Received background message ',
        payload
    );
});

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