-
Notifications
You must be signed in to change notification settings - Fork 448
Best practice to init firebase #613
Comments
I have been using this plugin for well over a year now in an angular app. And I have always called the Primarily the init function never resolves and any calls to firebase after that result in a It seems there are a few others having similar issues with running init first. It seems the consensus so far is the use the timeout method. |
Updating the embedded demo-ng app to 5.2.0 and will see what |
@ShawnPavel I've moved my init code to
Perhaps your init is different, so can you replace yours with mine and see if we can narrow this down? |
@EddyVerbruggen I dropped in your init directly replacing mine, and the "Firebase Initialized" is never printed. |
Interesting.. at this point we can do one of 2 things:
|
I'll try one first. |
OK, if that works we'll need to dig into your project I'm afraid. |
I will say, that I've done all this testing to this point on Android. |
@EddyVerbruggen I can confirm that your initialization as well as my old initialization code work fine on iOS. So this appears to be an Android related issue. |
Oww, the OP mentioned iOS so I focused on that. I'll take a look at Android. |
@EddyVerbruggen I attempted to run the android demo but I get an error:
|
Yeah got that one as well and fixed it locally. Better yet I found the culprit with NativeScript 3.4 and this plugin on Android:
The Fix inbound! |
Getting this error on NS 3.4.1 // Firebase plugin 5.1.8 I have firebase require in main.ts and call firebase init in app.cmp OnInit but keep getting the duplicate resource error from protobufs. What am I missing? Main.ts
app.component.ts
Error:
|
@eleventhaus - try to import firebase like this |
My ide throws an error for no exported member when using
Also tried use |
@eleventhaus - try this - |
Same as original error :S I appreciate the help!! Any other ideas? |
I have used, |
tried downgrading to 3.4.0/5.1.7 and tried each of the different imports with no luck |
same error here, tried all different versions... any update on this? |
Same error here but in different plugin, its gives duplicate resource error for semver.min.js and semver.min.js.gz. Any help on this would be appreciated. |
I'm still getting this error when I update any HTML/sass file. Do we have the right way to init the app in the documentation? |
Hi guys,
I am trying to get what is the right way to init firebase (I am working on Angular project).
In the beginning I've put the
firebase.init()
in themain.ts
but after I started to work on IOS I didn't received a background messaging on IOS so the thing that did the work for me was or to put thefirebase.init()
on 1000ms timeout onmain.ts
or to put it on the first page that I route to.The thing is that I want to make the user login as he open the app, like this:
Now, the thing is that the
setTimeout
solution is an ugly solution, but it works just fine, but when I implements the "prettier" solution of putting theinit
function on the first pagengOnInit
function the init function never resolved, and I'll explain:This is the "prettier" solution (exactly as @EddyVerbruggen wrote in the demo):
The buggy issue here is that the
init
function never resolved.After debug the actual code of
init
function infirebase
module in those two situation I found out that the following:when putting the init inside the first component in looks like it gets to this line
appModule.on(appModule.launchEvent, runInit);
but it seems like theappModule.launchEvent
never raise or already raised, so the firebase init never happen and it is never resolved, so the use cannot automatically login into the app.when putting it in the
main.ts
withsetTimeout
it looks like it gets to this linerunInit();
and all works just fine but this is a very ugly and bad performance solution.PLS!
What is the right way to init the firebase?
Thanks a lot :)
The text was updated successfully, but these errors were encountered: