-
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
Cannot read property 'FacebookAuthProvider' of undefined - 2.0.0-beta.5 #576
Comments
@mquentin I don't get this error, infact I am able to get FacebookAuthProvider. Snippet from my code: constructor(public af: AngularFire, public auth: FirebaseAuth) { } Snippet of my package.json "dependencies": { |
Hello @mukesh51, my package.json sets up theses dependencies (I will repeat myself, but this issues didn't occur when I was using 2.0.0-beta.4) : "dependencies": { So far, I do not get what could be wrong... |
Do you want to share your code or may be plnkr. |
Hello mukesh51, I tried to create a plunker but it was definitely hard to set up the same conf. Fortunately, I fixed the issue by forcing the version of firebase to 3.4.0. From |
Hi I'm still getting this, even when trying with @mquentin 's solution. Regards |
@Znow Can you provide a repro? A github repo or a plnkr would be excellent. |
@davideast - https://github.com/Znow/ZnowBlog - based on angular2-webpack, and then added stuff for angularfire2. Thanks |
I'm also getting this on the plunker from the angularfire2 readme: |
Yep, that's the official AngularFire2 plunker template. There seems to be an incompatibility between Firebase 3.4.1 and AngularFire2 2.0.0-beta.5. Changing the Firebase version to a strict 3.4.0 ("https://npmcdn.com/[email protected]/" in systemjs.config.js on that plunker) is a workaround until they fix it. |
@Auxilinaut - Angular2-webpack isn't using systemjs, as I see. Regards |
I am using "angularfire2": "^2.0.0-beta.6". |
I have the same problem. And if I do what @mcchae7 suggests I receive this error:
|
Hello, I encountered the same error (Cannot read property 'FacebookAuthProvider' of undefined) using the 2.0.0-beta.6. As mentioned by @mcchae7, in angularFire2.umd.js, at line 5, the retreived firebase object does not seems to be the good one (or Am I doing something wrong?) The one actually retreived owns the following properties:
If, at the beginning of this function, I added the following instruction and it worked. I first thought that changes related to the issue #525 could be somehow related but as they are tagged as 2.0.0-beta.6 and that @mquentin encountered the problem in 2.0.0-beta.5, I am not so sure anymore. My package.json file looks like this:
My systemjs.config.js file looks like this:
and My app.module.ts looks like this
Concerning @Judahh issue, have a look here I hope this will help, Have a good day, |
I got the same issue. Solved by adding Thanks for the help! |
This is still an issue, and the above solutions haven't worked for me |
I solved my issue, because for some reason I can't |
I see a typo in the syntax. It should be import * as firebase from 'firebase' What error you get when you import firebase. Ionic 2 App works fine. Have a look at issue #691 |
I am using ionic2 and I had this issue too. I had to add a custom rollup.config.js script (not sure every option here is actually needed):
from here https://forum.ionicframework.com/t/ionic-2-rc-0-and-firebase-not-angularfire/65018/7 Also have Note that you set where your custom config is in package.json with:
Hope this helps someone save some time and maybe make it easier to find a proper solution |
I went down the config route but I really don't think that's the best way to go. In the end, whatbworked for me was updating all the angular versions to 2.2.1. Then it worked |
@Rambatino how did you update all angular versions? |
@isaquesuzuki Change version of angular packages in package.json and run npm update |
Thanks @samedii. Is there any problem if npm warns me about [email protected] requiring a peer of @angular/[email protected]? |
@isaquesuzuki Try and see if it works. I think I maybe got it to work by using version 2.1.1 and not 2.2.1 |
I have two projects, ones is working, the other one, it isn't, the one that is working is showing more files loaded when I pause the execution just before var _a = firebase.auth;, the one that it's not working it's only showing firebase.js. The one that it's working shows app.js, auth.js, database.js, storage.js and firebase.js. The version that is working is 3.4, the one that it's not working is 3.6.3. For me, to make v3.6.3 to work (for now, not a solution, just a workaround), was to include this lines: in firebase.js |
@arielcessario this works for me too as a workaround. Any word on the official solution to this issue? After digging a bit deeper I was able to figure out a decent solution. I just changed my
|
I added and updated wiki pages for that for Angular2 seed. this.addPackageBundles({
name: 'firebase',
path: 'node_modules/firebase/',
packageMeta: {
main: 'firebase-browser.js',
defaultExtension: 'js'
}
}); https://github.com/mgechev/angular-seed/wiki/Integration-with-Firebase |
@xmcchae7 I updated the project.config.ts as above, but still get 'Uncaught TypeError: Cannot read property 'FacebookAuthProvider' of undefined' after a prod.build. Would you have any other ideas on this fix for this? |
@stuartdrennan I used Firebase only, you can see my example here -> |
@mcchae7 thanks, sorry. That doesn't help with my project for some reason though. I'm using angularfire2.
Its fine in development, but only errors on prod.build version. Any thoughts would be much appreciated? :) |
For a test, I cloned the latest angular2-seed and installed only angularfire2 with the same result. Fine in development, errors on production build. The https://github.com/mgechev/angular-seed/wiki/Integration-with-AngularFire2 intructions say to use [email protected] & [email protected] but [email protected] doesn't contains 'firebase-browser.js' so the build is not happy with that version. |
Reverts Firebase version to 3.4.0 to work around #576.
Reverts Firebase version to 3.4.0 to work around #576.
firebase = firebase.firebase; dont work when
to solve this then use
and now you can use |
This is still an issue with |
Making the change in the Any suggestion? thanks!! Edit: I solved this. I adapted the imports to the new object structure, I had to disable the tslinter as well. I will keep doing some test around that, if I find something new, I will put here. Thanks |
I've faced with the same issue. Resolved with changes angularfire2.udm.js file as @AnthonySoler and @evellynsc saggested. But I not sure that's best aproach, because it might be a reason of another issues in future. |
Has there been any update on this? I've tried adding the firebase = firebase.firebase; bit to angularfire2.umd.js file and am still getting errors. |
Thanks @arielcessario , I have fixed it.. |
Hello,
Since I have updated my angularfire2 to the 2.0.0-beta.5 version, I have got an error about the FacebookAuthProvider.
I do not use this provider and it seems that the problem come form my loaded angularfire2.umd.js file.
Do you guys encounter the same issue ?
The text was updated successfully, but these errors were encountered: