-
Notifications
You must be signed in to change notification settings - Fork 129
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
Cannot read property 'GoogleAuthProvider' of undefined #38
Comments
Hey, I've been toying with this library the last few days and I may be able to point you in hopefully a helpful direction? I found that this plugin already had the gradle implementation set correctly, so I did not need to add it to my However, I did find that forgetting to add the plugin in |
@mckelveygreg thanks for the feedback. I can confirm that you are correct, I don't need the app level gradle configuration. However, I also verified that I did add the plugin in MainActivity.java. I tried again uninstalling and reinstalling this plugin and I still get this error, The only way I am able to get the plugin working properly is to change this import I believe this is the only change I need and then I am able to get the providers I need (google.com, facebook.com) to work properly. I forked this repo temporarily so that I can experiment with it, but I'd like to use it properly. Any additional advice is more than welcome. Thanks!! |
Hello Justin, The Please, can you verify the Firebase App initialization in web tier? This is required to the plugin work correctly. Case the Firebase App are not configured on web, please, follow the instructions of Add Firebase SDKs and initialize Firebase on official docs. Best regards, |
Hi Bernardo, I believe it's happening before the native call. It is happening when I hit the
I can confirm that I am initializing firebase in the web tier, but I fear I'm not initializing it correctly. Here's what I'm doing:
Then I am injecting firebase into components where they are needed. |
Hi Justin, I’m not sure about, but please, can you remove the line Just in case, on my web project I'm using In time, second though: We have two Firebase libraries on node_modules! In your code, you are initializing the Firebase App from Just to be sure that is correct, please can you try changing your import to The big question is, what is the correct way to import Firebase? This comment of Michel on firebase-js-sdk issue 1008 may help us! Best regards, |
@baumblatt thank you for the additional notes. Sorry for the delay, I was focusing on a different issue for a few days. I'll run some more tests today and let you know what I find. |
@baumblatt, ok, I've tested this again today. I tried your suggestions but to no avail. After testing here's what I did find. When I import now I've changed all of my imports to So, then in the forked version of your plugin, in The problem appears to me to be related to the way stencil bundles the dependencies. Maybe related to Rollup and/or the way our app is configured. Here is my stencil.config.ts:
capacitor.config.json
tsconfig.json
I will continue to research and test, but I don't know what to do except to change that import. Please let me know if I can give you more information that would help. Thank you!! Still loving this plugin, wish I could figure out what I'm missing. |
Hi Justin, Let's try this, I will implement the import like it works on your stencil project and try it on my Angular CLI project. If everything works for me, I will bump the version on npm. As soon I have a results, I will let you know. Best regards, |
Sorry to hijack this thread with a slightly off question. Has anyone had any luck setting up this plugin in an ionic react project? Unfortunately android and android studio are not environments im familiar with, so i ended chasing my tail for some days trying to install this plugin and dealing with bugs. Also you seem like the right people to ask, is it possible to setup firebase/facebook login inside the app webview, without jumping out to the device's browser? I would much prefer that if possible instead of jumping out then back into the app. |
regarding my previous message, i had success in an ionic-react project, after managing some minor config merge bugs. Thanks for the library. |
@christopherShelleySocotree, any chance you can provide a snippet of your react code for how you implemented it? I am attempting to implement it in iOS and cannot seem to get Capacitor to recognize the plugin (i.e. provide it within Either an instance of firebase.auth.Auth must be passed as an argument to the
firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance
must be initialized via firebase.initializeApp() I plan on checking it in Android but I need to fix a gradle merge issue first. |
Hi @baumblatt !! Just checking in to see if you had a chance to test the above? If you'd like, I would be happy to push a PR showing what I did. If it would make things easier? Just let me know how you'd like to proceed. |
Hi Justin, Really sorry about the delay, honestly I just forgot. About the case, we fall in a dilemma, changing the import will break the Angular's builds, with the message below::
The Angular's build go back to work after the suggested flag, but I don’t know the effects of this changes on large projects. Is there another way out? Best regards, |
Hi @baumblatt, I did a little more research today and it looks like a more durable solution for the above error could be to use Just as a note, all of the stencil/firebase examples I find are importing as Still researching on my end, I'll let you know if I find anything useful. Update: This is a pretty good explanation of the |
Ok, @baumblatt, I went ahead and tested my fork using only After more research tonight, I found out that TypeScript has recommended setting esModuleInterop to |
Hi Justin, The The only issue is that will brake existing Angular applications. But as exposed here, this is required to support stencil. Please, just make sure that this is the only way out. Best regards, |
@baumblatt I suppose another alternative would be to fork the plugin, one for Angular (other) and one for Stencil, but it seems like overkill to do that for a small change like this. Our app is a Stencil + Capacitor only mobile app (no other ui framework). Bernardo, your app is an Angular app and it is in production, is that right? Maybe we can take our time and you can test it out on your side for awhile so that you can feel comfortable before you put it into production. We're not ready for production use yet, so we have some more time on our side. Our intention is to use this in production, but we are at least a couple of months out. Anyway, I'm still looking for another way to solve this and I'll keep you posted if I learn anything. |
Hi, I don’t think fork is a good idea, it's better to go forward with this change. I will document the change and create the version. Best regards, |
Hello Justin, Please take a look at v0.3.0 and see with everything is working on Stencil now. I'm Looking forward to hearing from you. Best regards, |
Hello Bernardo, I have tested v0.3.0 and all is well on the Stencil front. Thank you for the quick assist on this, we're very pleased with this plugin. Closing this issue. |
We are building an Ionic Stencil (no framework) app using Capacitor (hybrid mobile app).
So far, I'm loving this plugin (I only have a working build in Android so far). Great job unifying the login approach for all of the different providers. It initially took me awhile to get things working. I found that the following import in
facades.js
was causing the above error.import * as firebase from 'firebase/app';
And this is because
firebase.auth
infirebase.auth.GoogleAuthProvider().providerId
was undefined.So, I changed it to:
import firebase from '@firebase/app';
And now the reference to the provider is valid. I don't fully understand why this is happening. Can you give me some guidance for how to deal with this properly? Maybe I should be using a different version of
com.google.firebase:firebase-auth:17.0.0
? I downgraded to this version because the latest version was causing some manifest merge issues related to AndroidX.Here are the dependencies I'm using:
Root level gradle has:
classpath 'com.google.gms:google-services:4.3.2' // Google Services plugin
App level gradle has:
package.json
Please advise?
The text was updated successfully, but these errors were encountered: