Skip to content
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

TypeError: app.auth is not a function #1240

Closed
mehmet2006 opened this issue Sep 23, 2018 · 14 comments
Closed

TypeError: app.auth is not a function #1240

mehmet2006 opened this issue Sep 23, 2018 · 14 comments

Comments

@mehmet2006
Copy link

mehmet2006 commented Sep 23, 2018

  • Operating System version: Windows 10
  • Browser version: Google Chrome Version 69.0.3497.100 (Official Build) (64-bit)
  • Firebase SDK version: 5.5.1
  • Firebase Product: auth

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

@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@jordybulten
Copy link

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.

@Feiyang1
Copy link
Member

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

@mehmet2006
Copy link
Author

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.

@jordybulten
Copy link

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!

@mehmet2006
Copy link
Author

@jbweb it solved my problem too. thanks

@swftvsn
Copy link

swftvsn commented Oct 10, 2018

Thank you for this! (And curse you npm :))

@rcanu
Copy link

rcanu commented Oct 23, 2018

The solution of @jbweb worked for me as well.

@ishaqbhojani
Copy link

First npm uninstall firebase @angular/fire --save
then npm install firebase @angular/fire --save
worked for me

@calibri87
Copy link

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),

@ramen-mukherjee
Copy link

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

@Feiyang1
Copy link
Member

Please open a new issue with steps to reproduce. You are less likely to get help from a closed issue.

@ramen-mukherjee
Copy link

@Feiyang1 : Thank You for the update. A new issue #1696 has been opened. Regards.

@agustin107
Copy link

I've solved with this comment
#752 (comment)

@firebase firebase locked and limited conversation to collaborators Oct 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants