angular / angularfire

Angular + Firebase = ❤️
https://firebaseopensource.com/projects/angular/angularfire2
MIT License
7.66k stars 2.19k forks source link

AngularFireModule breaks ServiceWorkerModule #2441

Closed vandres closed 3 years ago

vandres commented 4 years ago

Version info

Angular: 9.1.3

Firebase: 7.14.2

AngularFire: 6.0.0

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

Steps to set up and reproduce

I am working with the Angular service worker. Some time ago everything was working fine, but now as soon as I import die AngularFireModule, all my Service Worker are gone.

        ServiceWorkerModule.register('service-worker.js', {enabled: true}),
        AngularFireModule.initializeApp(environment.firebase),

If I comment out AngularFireModule, the service worker are back. Going back to rc-1, I'll get them to work again, too.

Expected behavior

Service worker are working

Actual behavior

Service worker are not working

Splaktar commented 4 years ago

You can use https://angular.io/api/service-worker/SwRegistrationOptions to define an alternative registration strategy to work around this until AngularFire is fixed to let Angular stabilize.

askilondz commented 4 years ago

I had to revert back @angular/fire@5.4.2 for the service worker to work. Something in version 6 is breaking it.

Benneee commented 4 years ago

Hi @askilondz , I'm current facing an error while trying to use firebase for push notifications, I also downgraded the angularfire version to 5.4.2, but the error persists. Did you have to fix this same type of error? Can you suggest a fix?

FirebaseError: Installations: Create Installation request failed with error "400 INVALID_ARGUMENT: Request contains an invalid argument." (installations/request-failed).

askilondz commented 4 years ago

@Benneee Sorry I have not seen that error. Do you have a web app project set up on the firebase console and are you using the project config object properly to load firebase in your app? That sound like your firebase project is just straight up not loading.

Benneee commented 4 years ago

Yeah, the first thing I did was to set up a web app on the firebase console, I'm also using the project config straight from firebase. I made a little progress today, I uninstalled firebase and angularfire earlier today and used ng add @angular/fire instead. I could generate the token on Firefox but the error persisted on Chrome.

jamesdaniels commented 3 years ago

We've fixed some zone issues in AF 6.0 in recent patches, this should be resolved now.