-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AngularFireModule.initializeApp(...) fails in ng6 prod build #1635
Comments
angularfire2 @next rc8 :+1 why 7 arguments ? |
Relates to angular/angular#23609 |
It seems like it's not an issue with us but angular, I'll leave this open for now though so people can find it and incase angular gives us any direction. E.g, we should do something different with our metadata. |
@jamesdaniels But why this issue doesn't appear in rc7 but only rc8. The call signature is same. Or I am missing something? |
I'm presuming it just has something to do with ng6; but we did change a couple other things since rc7. Namely the addition of AppConfig. Wait... I might have just thought with something. I did clear out the old overloaded method style as we are using optionals and tslint was complaining about it being unnecessary, maybe that had something to do with it. Let me experiment with that. |
There also is some suggestions in the angular issue that seems to solve this for others: comment |
Yeah, no dice on that change; I did it before rc7. |
I'm having this error too. |
@brijmcq I'd recommend the work-around stated in the issue body in the meantime. |
@jymdman Thanks for providing the new way to init the firebase config |
To me in Ionic 3 I have that problem as I configure the buildOptimizer.? |
What is the current workaround (for now)? |
Solution is to drop .initializeApp(...) and use providers like this:
|
FYI #1641 will make this cleaner by making name and appconfig optional. |
Sorry, where do I locate the types for the providers? This has them but fails to load as Module does not exist here.
|
|
Humm that throws
|
@Ajonp Same here. |
@Ajonp @fergalmoran at the providers, just use where ' environment.firebase' is the path to your firebase config! If you need a AppNameToken or AppConfigToken, you can use the following (replace undefined (default) with the token you want to use)
|
The truth is all very confusing and it is not clear. import { BrowserModule } from '@angular/platform-browser'; import { MyApp } from './app.component'; // import { AngularFireModule } from 'angularfire2'; import { export const firebaseConfig = { @NgModule({ |
@alsit remove And add these 2 object to the
|
I think the Angular compiler is having trouble analyzing these lines Possible Solution?Force the second arg to |
It works for me when I add just the main provider instead of all of them.
|
I get this error when trying to import FirebaseOptionsToken from angularfire2:
|
Just cut rc.9, which fixes this issue. We've replaced Sorry for the breaking change folks, I put a Thanks for all your patience and being awesome users! Btw, to sweeten the deal I got the AngularFireFunctionsModule merged and pushed with rc.9; you should give it a shot ;) Getting FCM support in will be my next priority. |
thanks |
Could you describe the solution? I'm having trouble with that line for --aot option....Which are the steps to replace AngularFireModule.initializeApp(environment.firebase) statement? since it's the line is breaking the build |
Update to the latest version of angularfire2, there this issue is fixed |
I fixed the issue but i had to put angularfire2 initialization in providers array, otherwise it was not fixed....I have the last version |
I can`t solve the problem, please i need help : ionic 3.20.0 "firebase": "^5.2.0-0", import { NgModule, ErrorHandler } from '@angular/core'; import { HomePage } from '../pages/home/home'; import { AngularFireModule } from 'angularfire2'; //I deleted the firebase data for post here, but this data is setup good in my code import { StatusBar } from '@ionic-native/status-bar'; import { InAppBrowser } from '@ionic-native/in-app-browser'; import { CallNumber } from '@ionic-native/call-number'; import { HttpClientModule } from '@angular/common/http'; import { OneSignal } from '@ionic-native/onesignal'; import { UsuarioSesionService } from '../providers/usuario-sesion'; @NgModule({
],
] |
I did see that comment but the problem is the same, i don`t know what to do |
Please update to rc.9 or greater. |
{ provide: FirebaseOptionsToken, useValue: environment.firebase } fixed my issue |
Version info
Angular:
^6.0.0
Firebase:
^5.0.2
AngularFire:
5.0.0-rc.8.1-next
Other (e.g. Ionic/Cordova, Node, browser, operating system):
How to reproduce these conditions
Failing test unit, Plunkr, or JSFiddle demonstrating the problem
Steps to set up and reproduce
AngularFireModule.initializeApp(....) fails when build with prod:
NgModule looks like:
Solution is to drop .initializeApp(...) and use providers like this:
Sample data and security rules
<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->
Debug output
** Errors in the JavaScript console **
** Output from
firebase.database().enableLogging(true);
**** Screenshots **
Expected behavior
Don't know if this is the expected behavior with rc8?
If it is, docs should be updated when rc8 is released to match this. (I can create a fix for this)
Actual behavior
The text was updated successfully, but these errors were encountered: