angularfire: Angular Universal with Angular Fire is breaking - IDBIndex is not defined
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.
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.
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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 21 (6 by maintainers)
@all do you have any news other than downgrading?
I do not know. but it seems to me that the maintainers will not give a damn about this situation.
Filed as an issue over there, I’m going to close this issue but pin it; we can of course continue to discuss.
We’ve been looking into this, it’s not a problem with AngularFire though; it seems to be a problem with a dependency of Firebase JS SDK, idb, now that Angular Universal is targeting modules in Node.js.
Any update on this? Seems like this issue has been lurking around for a long time now.
@ALL any solutions yet ?