Skip to content
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

Bug and solution: angularfire2 auth not working with angular universal #1270

Closed
hiepxanh opened this issue Oct 15, 2017 · 3 comments
Closed

Comments

@hiepxanh
Copy link
Contributor

hiepxanh commented Oct 15, 2017

Thanks for @katowulf advice.

Think you found a bug?

Yes, I found a bug in angular auth when running on nodejs with angular universal universal starter repo

Version info

  • @angular/ 4.2.4
  • firebase: 4.5.0
  • angularfire2: 5.0.rc-2

Steps to set up and reproduce

  1. clone universal starter repo
  2. add firebase module to app module
  3. add auth in app.component.ts
    image
  4. run npm run build:dynamic && npm run serve:dynamic
  5. get error

I make an sample repository here to view my code

ERROR

Failing test unit, Plunkr, or JSFiddle demonstrating the problem
image

Expected behavior

In my opinion, angularfire2 already have XMLHttpRequest library, but maybe some problem when bootstrap. Maybe you can fix this bug and I don't have to add XMLHttpRequest manually

Actual behavior

get error with XMLHttpRequest.
Solution: I add this on top, error gone.

// server.ts file
(global as any).XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
// your code next...

@hiepxanh hiepxanh changed the title angularfire2 auth not working with angular universal Bug and solution: angularfire2 auth not working with angular universal Oct 16, 2017
@patrickmichalina
Copy link

Firebase doesn't official support universal yet :(

I have worked Auth and the RTDB into my starter with some dependency injection monkey patching if you want to try it out before official universal support is here:

https://github.com/patrickmichalina/fusebox-angular-universal-starter

@hiepxanh
Copy link
Contributor Author

thank you for that

@davideast
Copy link
Member

Closing to keep issues consolidated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants