I got this error when I upgraded to Firebase 5.5.1
But same code works when I downgrade to Firebase 5.4.2 (no error)
ERROR Error: Uncaught (in promise): TypeError: app.auth is not a function
TypeError: app.auth is not a function
at auth.js:12
Firebase 5.5.1
@angular/fire 5.0.0
I found a few problems with this issue:
Same problem here.
@angular/fire: 5.0.2
firebase: 5.4.2 has no problems
If i update to 5.5.1 the same error message appears. Even when stripping my code and only implementing the @angular/fire Auth example.
Hi @mehmet2006, @jbweb, I tried firebase 5.5.1 with @angular/fire 5.0.0, and auth works fine for me. You said firebase 5.4.2 works fine, so it might not be the problem - did you import AngularFireAuthModule ? Otherwise can you please provide detailed steps to reproduce? thanks
Hi @Feiyang1 ,
I have imported AngularFireAuthModule in app.module.ts
...
import { AngularFireAuthModule } from '@angular/fire/auth';
...
@NgModule({
imports: [
...
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule,
AngularFireAuthModule,
....
and in my component I have imported AngularFireAuth and auth;
...
import { AngularFireAuth } from '@angular/fire/auth';
import { auth } from 'firebase/app';
...
Like I said, my app is working correctly with these imports in firebase 5.4.2, but throws error in 5.5.1.
As far as I know, there is no breaking changes between 5.4.2 and 5.5.1. So I think the problem is in 5.5.1.
If you check release notes, last two updates has "typings are created in the wrong location", and "typings for the firebase package were referenced incorrectly" for other packages. I believe Auth package still needs a fix.
Found (my/the) problem!!!
I also tried building an app from scratch, using my existing app as reference. This way it worked fine!
But after copying package.json and removing node_modules, my old app still didn't work.
Then i checked the differences in package-lock.json and found A LOT of minor version differences for firebase!
So i removed package-lock.json and node_modules (again) en reinstalled.
Now everything works fine!
@jbweb it solved my problem too. thanks
Thank you for this! (And curse you npm :))
The solution of @jbweb worked for me as well.
First npm uninstall firebase @angular/fire --save
then npm install firebase @angular/fire --save
worked for me
I'm still having trouble with this.
My lib versions:
"firebase": "^5.9.3",
"@angular/fire": "^5.1.2"
Error:
ERROR { Error: Uncaught (in promise): TypeError: app.auth is not a function
TypeError: app.auth is not a function
at /user_code/dist/server.js:152999:24
at ZoneDelegate.invoke (/user_code/dist/server.js:555:26)
at Zone.run (/user_code/dist/server.js:314:43)
at NgZone.runOutsideAngular (/user_code/dist/server.js:20244:28)
at new AngularFireAuth (/user_code/dist/server.js:152997:26)
at _createClass (/user_code/dist/server.js:24259:20)
at _createProviderInstance (/user_code/dist/server.js:24221:26)
at resolveNgModuleDep (/user_code/dist/server.js:24185:21)
at _createClass (/user_code/dist/server.js:24251:29)
at _createProviderInstance (/user_code/dist/server.js:24221:26)
at resolvePromise (/user_code/dist/server.js:995:31)
at resolvePromise (/user_code/dist/server.js:952:17)
at /user_code/dist/server.js:1056:17
at ZoneDelegate.invokeTask (/user_code/dist/server.js:587:31)
at Object.onInvokeTask (/user_code/dist/server.js:20276:33)
at ZoneDelegate.invokeTask (/user_code/dist/server.js:586:60)
at Zone.runTask (/user_code/dist/server.js:359:47)
at drainMicroTaskQueue (/user_code/dist/server.js:765:35)
at ZoneTask.invokeTask (/user_code/dist/server.js:666:21)
at ZoneTask.invoke (/user_code/dist/server.js:651:48)
rejection:
TypeError: app.auth is not a function
at /user_code/dist/server.js:152999:24
at ZoneDelegate.invoke (/user_code/dist/server.js:555:26)
at Zone.run (/user_code/dist/server.js:314:43)
at NgZone.runOutsideAngular (/user_code/dist/server.js:20244:28)
at new AngularFireAuth (/user_code/dist/server.js:152997:26)
at _createClass (/user_code/dist/server.js:24259:20)
at _createProviderInstance (/user_code/dist/server.js:24221:26)
at resolveNgModuleDep (/user_code/dist/server.js:24185:21)
at _createClass (/user_code/dist/server.js:24251:29)
at _createProviderInstance (/user_code/dist/server.js:24221:26),
Dear Team,
I updated my Angular 7.2.12 to latest (I perform regular updates). I am using @angular/fire (5.1.2) for Google OAuth & Firebase (5.9.4). After the recent updates, I聽am getting following error while running the application. As of now, no build errors. Can't pinpoint the error with Augury, since the application is not booting up and Augury is considering this project as not a Angular project. Error-
AppComponent.html:1 ERROR TypeError: app.auth is not a function
at auth.js:24
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:7929)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (polyfills.js:7688)
at NgZone.push../node_modules/@angular/core/fesm5/core.js.NgZone.runOutsideAngular (core.js:17258)
at new AngularFireAuth (auth.js:22)
at _createClass (core.js:21273)
at _createProviderInstance (core.js:21235)
at resolveNgModuleDep (core.js:21199)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:21907)
at resolveDep (core.js:22278)
Please help.
Thank You
Regards
Please open a new issue with steps to reproduce. You are less likely to get help from a closed issue.
@Feiyang1 : Thank You for the update. A new issue #1696 has been opened. Regards.
I've solved with this comment
https://github.com/firebase/firebase-js-sdk/issues/752#issuecomment-389605982
Most helpful comment
Found (my/the) problem!!!
I also tried building an app from scratch, using my existing app as reference. This way it worked fine!
But after copying package.json and removing node_modules, my old app still didn't work.
Then i checked the differences in package-lock.json and found A LOT of minor version differences for firebase!
So i removed package-lock.json and node_modules (again) en reinstalled.
Now everything works fine!