Skip to content

Cannot read property 'container' of undefined Angular Universal #4949

@zal1000

Description

@zal1000
  • Operating System version: Windows 20H2
  • Browser version: Angular universal pretender ( @nguniversal/builders 12.0.0, @angular/platform-server 12.0.1)
  • Firebase SDK version: 9.0.0-beta.2
  • Firebase Product: auth

[REQUIRED] Describe the problem

When I try to load the page, the server sends this error back

Steps to reproduce:

TypeError: Cannot read property 'container' of undefined
    at Object._getProvider (D:\Github\waik-hu\node_modules\@firebase\app\dist\index.cjs.js:268:16)
    at getAuth (D:\Github\waik-hu\dist\waik-hu\server\main.js:114683:24)
    at new AppComponent (D:\Github\waik-hu\dist\waik-hu\server\main.js:216217:72)
    at NodeInjectorFactory.AppComponent_Factory [as factory] (D:\Github\waik-hu\dist\waik-hu\server\main.js:216258:10)
    at getNodeInjectable (D:\Github\waik-hu\dist\waik-hu\server\main.js:59399:44)
    at instantiateRootComponent (D:\Github\waik-hu\dist\waik-hu\server\main.js:65966:23)
    at createRootComponent (D:\Github\waik-hu\dist\waik-hu\server\main.js:68319:23)
    at ComponentFactory$1.create (D:\Github\waik-hu\dist\waik-hu\server\main.js:80981:25)
    at ApplicationRef.bootstrap (D:\Github\waik-hu\dist\waik-hu\server\main.js:85452:42)
    at D:\Github\waik-hu\dist\waik-hu\server\main.js:85165:64

Relevant Code:

    //im not sure about it, but its probably that part
    const auth = getAuth();

    onAuthStateChanged(auth, user => {
      const defavatar = 'DEFAULT_IMAGE_URL_HERE';
      if(user) {
        this.userpp = user.photoURL ? user.photoURL : defavatar;
        this.msg.success(`Bejelentkezve mint: ${user.displayName}(${user.email})`)
      } else {
        this.userpp = defavatar;
      }
    });

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions