[firebase_messaging]: Firebase service worker gets re-registered with default URL even though previous, custom registration took place #16667
Labels
Needs Attention
This issue needs maintainer attention.
platform: web
Issues / PRs which are specifically for web.
plugin: messaging
type: bug
Something isn't working
Is there an existing issue for this?
Which plugins are affected?
Messaging
Which platforms are affected?
Web
Context
From what I understand of the web service worker documentation, even after
flutter_service_worker.js
has been registered with the top level scope/
,firebase-messaging-sw.js
, which is the default service worker URL of the Firebase JS SDK and Flutterfire, will not be downloaded through flutter_service_worker.js. I understand that all service workers are downloaded either regularly or through the browser cache. Because of this, firebase-messaging-sw.js may be cached and updated versions may be ignored by web clients. And because of this, the developer needs to append a version number to force the browser to fetch the updated version :firebase-messaging-sw.js?v=VERSION
.Expected results
Flutterfire automatically registers
firebase-messaging-sw.js
for the developer.The following documentation explains how to perform custom registration of the Firebase service worker:
https://firebase.google.com/docs/cloud-messaging/flutter/receive#web
From there, it is theoretically possible to append a
v=VERSION
query string parameter to the URL.Actual results
Even though the following code is executed:
Flutterfire and/or the Firebase JS SDK seems to re-register 'firebase-messaging-sw.js' afterwards, with the same scope. Therefore, the previous registration is lost and of no use.
Reproducing the issue
Firebase Core version
3.2.0
Flutter Version
3.24.3
The text was updated successfully, but these errors were encountered: