firebase / firebase/firebase-js-sdk

FR: Firebase Cloud Messaging - file:// based environment support

Open
#3,034 1 comment 0 reactions 0 assignees View on GitHub
api: messaging feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

Describe your environment

* Operating System version: KaiOS 2.5.0
* Browser version: Same
* Firebase SDK version: 7.14.2
* Firebase Product: analytics

Describe the problem
I am developing an app for KaiOS, a fork of the old Firefox OS, for which apps are based on HTML5 + JS. When compiling and running on device, Firebase Cloud Messaging stops working. I receive an error as follows. I believe the issue is due to the fact that on device the app is served in the browser via a file:// based URL scheme rather than a http:// based scheme.

```
DOMException: A request was placed against a transaction which is currently not active, or which is finished.
```
In my research, I have found that Cordova, Expo, and other file:// based environments have had issues around the use of IndexDB not being supported, which FCM seems to rely on. I can confirm that KaiOS does have full support for IndexDB, however the above issue persists.

#### Relevant Code:
```
import firebase from "firebase";

const messaging = firebase.messaging();
messaging.usePublicVapidKey("");

messaging.getToken().then((currentToken) => {
...
}).catch((err) => {
...
});
```

Note: I am aware that this is very similar to my other issue I logged: #3027 however it is for a different Firebase product so I wanted to document both.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.