Skip to content

Angular Universal with Angular Fire is breaking - IDBIndex is not defined #3113

Closed
@miguelsmuller

Description

@miguelsmuller

I have a project i am trying to implement ssr with universal angular. but I'm not getting it.
I thought it was a problem in my code until I started a project from scratch to test and found something was wrong.

**ReferenceError: IDBIndex is not defined**

I commented on this open issue in the angular universal repository

Version info

Angular CLI: 13.1.2
Node: 16.13.1
Package Manager: npm 8.1.2
OS: linux x64

Angular: 13.1.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1301.2
@angular-devkit/build-angular   13.1.2
@angular-devkit/core            13.1.2
@angular-devkit/schematics      13.1.2
@angular/cli                    13.1.2
@angular/fire                   7.2.0
@nguniversal/builders           13.0.1
@nguniversal/express-engine     13.0.1
@schematics/angular             13.1.2
rxjs                            7.4.0
typescript                      4.5.4

How to reproduce these conditions

I created this empty project to simulate the problem and show that it's not an error in the code I made.
https://github.com/miguelsmuller/teste-project

I just followed the following steps:

  • ng new teste-project
  • ng add @angular/material
  • ng add @ngrx/store
  • ng add @ngrx/effects
  • ng add @nguniversal/express-engine
  • ng add @angular/fire

each command above is a commit from that test project

the last command (ng add @angular/fire) returned as shown in the image below. The informed parameters are also shown in the image.

Screenshot 2022-01-07 090417

and finally the error that is displayed when I run the command npm run build:ssr && npm run serve:ssr - image below in the right column. You can also see in this image on the left that when I run npm run start as csr no error is displayed.

Screenshot 2022-01-07 090956

Debug output

ReferenceError: IDBIndex is not defined
    at /home/migue/FromLinux/projects/teste-project/dist/teste-project/server/main.js:1:4322339
    at /home/migue/FromLinux/projects/teste-project/dist/teste-project/server/main.js:1:4644564
    at Object.<anonymous> (/home/migue/FromLinux/projects/teste-project/dist/teste-project/server/main.js:1:4644796)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

Expected behavior

I believe the expected is node running the app listening on port 4000

Actual behavior

The compilation process is going on but probably with some error because the npm run build:ssr is finished but the npm run serve:ssr is not terminated, it just displays the entire contents of the bundle on the console and then the ReferenceError: IDBIndex is not defined error appears

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions