You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 14, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 14, 2024. It is now read-only.
Hey,
I am using Angular2 webpack with Firebase for developing my application. Hence I am using this starter to build the entire application.
I searched through documentation for using firebase or angularfire2 with this but could not find any. The present angularfire2 docs use angular-cli & don't work with this.
Hey,
I am trying to integrate angularfire2 with this starter. Apparently I keep getting an error AngularFire not found, as it is running on the server side. The setup seems to be fine for webpack. I don't know how to bypass this problem of server-side and make it work with this starter.
Could any of you give ideas about a workaround for it? @manekinekko
@beckmeindia I did some diggings. Here are my tldr: We simply need to add support for AngularFire2.
My analysis:
One of the issues is coming from the FirebaseSdkAuthBackend implementation which requests this._fbAuth = _fbApp.auth();. However, _fbApp.auth() doesn't seem to work (??); and then this.-fbAuth is NULL all the way down.
@manekinekko Hey Wassem thanks a lot for your time and debugging. Will look forward to changes in the universal Authbackend by @davideast and try to implement what you have said & see if it somehow maybe works.
Also could I add you as a collaborator to the present repository so that we can commit new changes and maybe make it a universal-angularfire2-starter ?
Hi, I observed that the new angular2-webpack-starter has a very simple approach for integrating Angularfire2 through this:
add 'firebase' to tsconfig.json file.
install typescript 2.0.0 npm install typescript@2.0.0 --save
install angularfire with npm install angularfire2@next -- save
add "firebase" to types array in tsconfig in the module
{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
],
"types": [
"jasmine",
"firebase"
]
}
}
I have observed that the universal-starter uses an earlier version of angular2-webpack-starter.
Could you suggest a way to upgrade to the new angular2-webpack? @davideast@MarkPieszak@manekinekko
@manekinekko what is the current status of this issue? I am just catching up on open problems and it seems like there was some back and forth on this as we were playing catchup with the angular release. Can you check again on this when you get a chance and let me know?
Does universal play well with angularfire2? I see from angular/angularfire#191 that it looks like some custom code is needed and using the firebase nodejs version on the server..is that so?
Just out of curiosity I tried putting angularfire2 into this repository and I get the following error :
Error: Unexpected value '[object Object]' imported by the module 'AppModule'
at /Library/WebServer/Documents/universal-starter/dist/server/index.js:20332
This was trying to put the Angularfire2 module into the appModule. I guess it could be done via the browsermodule, but then its not possible to inject the angularfire2 service into components that ideally would be render on client and server..basically would be like maintaining two separate apps for server and client which is not so interesting maybe.
I think it would be super interesting to have even if just a recommendation on the universal repo on how to use angularfire2 with angular using universal, best practices or something like that.
+1. Any update on the possibility of using Universal with angularfire2 4.0.0-rc.0? There is a reference to window in database.js that does not seem to allow this.
Activity
manekinekko commentedon Jul 22, 2016
@beckmeindia what are you trying to accomplish? This starter is for Angular Universal not AngularFire.
joaogarin commentedon Jul 22, 2016
@beckmeindia I think you might be in the wrong repo? https://github.com/angular/angularfire2
Documentation is on https://github.com/angular/angularfire2/blob/master/docs/1-install-and-setup.md
beckmeindia commentedon Jul 23, 2016
@joaogarin thank you. I was referring to the wrong docs.
beckmeindia commentedon Jul 26, 2016
Hey,
I am trying to integrate angularfire2 with this starter. Apparently I keep getting an error AngularFire not found, as it is running on the server side. The setup seems to be fine for webpack. I don't know how to bypass this problem of server-side and make it work with this starter.
Could any of you give ideas about a workaround for it? @manekinekko
I have attached the repository here: https://github.com/beckmeindia/universal-angularfire2
I have also tried to address this issue here: r-park/todo-angular-firebase#77 (comment)
Thanks,
Rahul
manekinekko commentedon Jul 26, 2016
@beckmeindia I am gonna take a look at your issue tonight. I'll let you know.
beckmeindia commentedon Jul 26, 2016
Thank you so much Wassim
On 26 Jul 2016 19:34, "Wassim Chegham" notifications@github.com wrote:
manekinekko commentedon Jul 26, 2016
@beckmeindia I did some diggings. Here are my tldr: We simply need to add support for AngularFire2.
My analysis:
One of the issues is coming from the
FirebaseSdkAuthBackendimplementation which requeststhis._fbAuth = _fbApp.auth();. However,_fbApp.auth()doesn't seem to work (??); and thenthis.-fbAuthisNULLall the way down.Here are the steps to reproduce this issue:
FIREBASE_PROVIDERS,And then provide a custom implementation with stubbed methods, something like:
Following the base parent class:
But then you will end up with other errors, like this one:
So basically, we need a universal AuthBackend implementation.
Getting @davideast in the loop ^^
beckmeindia commentedon Jul 27, 2016
@manekinekko Hey Wassem thanks a lot for your time and debugging. Will look forward to changes in the universal Authbackend by @davideast and try to implement what you have said & see if it somehow maybe works.
Also could I add you as a collaborator to the present repository so that we can commit new changes and maybe make it a universal-angularfire2-starter ?
Cheers,
Rahul
manekinekko commentedon Jul 27, 2016
@beckmeindia sure
beckmeindia commentedon Aug 3, 2016
hey @manekinekko & @davideast
Any updates for the auth implementation?
Really excited to implement it on my website!
MarkPieszak commentedon Aug 18, 2016
Others interested in this as well. aspnet/JavaScriptServices#268
Hopefully we can get this in for 1.0 if it's not too involving? @davideast
beckmeindia commentedon Aug 24, 2016
Hi, I observed that the new angular2-webpack-starter has a very simple approach for integrating Angularfire2 through this:
add 'firebase' to tsconfig.json file.
install typescript 2.0.0 npm install typescript@2.0.0 --save
install angularfire with npm install angularfire2@next -- save
add "firebase" to types array in tsconfig in the module
{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
],
"types": [
"jasmine",
"firebase"
]
}
}
I have observed that the universal-starter uses an earlier version of angular2-webpack-starter.
Could you suggest a way to upgrade to the new angular2-webpack?
@davideast @MarkPieszak @manekinekko
beckmeindia commentedon Sep 14, 2016
Hey @manekinekko
Does the new update to rc6 solves the problem we were facing with Auth earlier?
Excited to hear about it
jeffwhelpley commentedon Oct 3, 2016
@manekinekko what is the current status of this issue? I am just catching up on open problems and it seems like there was some back and forth on this as we were playing catchup with the angular release. Can you check again on this when you get a chance and let me know?
beckmeindia commentedon Oct 19, 2016
I just checked with the updated versions of angularfire2 and angular-universal-nodejs.
It works perfectly fine with all the observables and authentication. So it's resolved.
Thank you so much guys!
@manekinekko @jeffwhelpley @MarkPieszak
doczoidberg commentedon Dec 4, 2016
is anywhere a starter project for angular universal with angularfire? Is am still struggling with it
joaogarin commentedon Feb 8, 2017
Does universal play well with angularfire2? I see from angular/angularfire#191 that it looks like some custom code is needed and using the firebase nodejs version on the server..is that so?
manekinekko commentedon Feb 8, 2017
@doczoidberg @joaogarin can you share some logs or error messages?
joaogarin commentedon Feb 8, 2017
I didn't actually try it yet..but I am thinking about using firebase, and if that is a good idea at this point..I will definitely be using universal.
I will try to get some tests running and see what happens. I will report back with what I find.
joaogarin commentedon Feb 12, 2017
Hello,
Just out of curiosity I tried putting angularfire2 into this repository and I get the following error :
This was trying to put the Angularfire2 module into the appModule. I guess it could be done via the browsermodule, but then its not possible to inject the angularfire2 service into components that ideally would be render on client and server..basically would be like maintaining two separate apps for server and client which is not so interesting maybe.
I think it would be super interesting to have even if just a recommendation on the universal repo on how to use angularfire2 with angular using universal, best practices or something like that.
samvloeberghs commentedon Mar 19, 2017
@joaogarin instead of importing AngularFireModule you could provide a substitute for AngularFire service in your app.node.module.
I mainly use AngularFire / Firebase for Auth.
In this AngularFireServer I use the req to get a cookie and do authentication with the JWT in it..
My AngularFireServer roughly looks like this:
joaogarin commentedon Mar 19, 2017
Yeah thats what I am doing now, essencialy have a provider for browser and server =) bit of DI swap magic and it works 👍
michaelwaihenya commentedon May 9, 2017
+1. Any update on the possibility of using Universal with angularfire2 4.0.0-rc.0? There is a reference to window in database.js that does not seem to allow this.
samvloeberghs commentedon May 10, 2017
I didn't tries with dB, but auth seems to work fine