firebase / firebase/quickstart-js
Strange behaviour FCM token gets generated sometimes after many refresh.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 3.7k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 6
Description
Basically my issue is that I'm trying to enable push notifications via FCM. When obtaining token, I have used demo code. Everything works fine if I create standalone .html file and add my code. However if I add the same code at the very top of tag before any other code in my WP build FCM token only gets generated after 3-4 hard refreshes.
I delete application each time I test this. On stand alone page FCM token gets generated from first load every time, on page that loads longer only after several attempts.
This has been driving me insane for a while now.
```
An error occurred while retrieving token. FirebaseError: Messaging: A problem occured while subscribing the user to FCM: TypeError: Cannot read property 'json' of undefined (messaging/token-subscribe-failed).
at Ce. (https://www.gstatic.com/firebasejs/7.6.0/firebase-messaging.js:1:24910)
at https://www.gstatic.com/firebasejs/7.6.0/firebase-messaging.js:1:2010
at Object.next (https://www.gstatic.com/firebasejs/7.6.0/firebase-messaging.js:1:2115)
at n (https://www.gstatic.com/firebasejs/7.6.0/firebase-messaging.js:1:886)
```
Contributor guide
Assessment
This issue has not been assessed yet.