Cannot read property 'FacebookAuthProvider' of undefined - 2.0.0-beta.5
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 ?
@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: var firebase = require('./app'); require('./auth'); require('./database'); require('./storage'); module.exports = firebase;
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 system.js.config firebase definition to point to firebase-browser.js instead of firebase.js.
'firebase': {
defaultExtension: 'js',
main: './firebase-browser.js'
}
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 https://github.com/mgechev/angular-seed/wiki/Integration-with-AngularFire2
@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 -> Full Source: https://github.com/GoEngin/GoEnginO firebase.initializeApp: https://github.com/GoEngin/GoEnginO/blob/master/src/client/app/app.component.ts using firebase: https://github.com/GoEngin/GoEnginO/blob/master/src/client/app/shared/util/dataaccess.ts
@mcchae7 thanks, sorry. That doesn't help with my project for some reason though. I'm using angularfire2.
"angularfire2": "^2.0.0-beta.6"
"firebase": "^3.6.4"
Its fine in development, but only errors on prod.build version.
I've tried all the suggestions I can see here; changing project.config.ts, changing angularfire2.umd.js fixes it in development but not in production.
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.
firebase = firebase.firebase; dont work when
packageMeta: {
main: 'firebase-browser.js',
defaultExtension: 'js'
}
to solve this then use
packageMeta: {
main: 'firebase.js',
defaultExtension: 'js'
}
and now you can use
firebase = firebase.firebase;
on angularfire2.umd.js file
This is still an issue with 2.0.0-beta.7.1-pre I still get Uncaught TypeError: Cannot read property 'FacebookAuthProvider' of undefined even though I am not using any auth providers. I have tried every approach mentioned here with no success, also tried downgrading to firebase 3.4.0
Any ideas?
Making the change in the packagemeta object fix the issue with the build process, but it seems other things get broken. In my case, I am using storage API and now the app is throwing an error related with it: firebase.storage is not a function.
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..