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

[6.0-rc.0] Analytics: global is not defined #2303

Closed
vandres opened this issue Jan 31, 2020 · 4 comments
Closed

[6.0-rc.0] Analytics: global is not defined #2303

vandres opened this issue Jan 31, 2020 · 4 comments

Comments

@vandres
Copy link

vandres commented Jan 31, 2020

Version info

Angular: 9.0.0-rc.12

Firebase: 7.8.0

AngularFire: 6.0.0-rc.0

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

Steps to set up and reproduce

Just importing the Analytics Module

imports: [
        BrowserModule,
        AngularFireModule.initializeApp(environment.firebase),
        AngularFireAnalyticsModule,
        NoopAnimationsModule,
        ComponentsModule
    ],

Debug output

Unhandled Promise rejection: global is not defined ; Zone: ; Task: Promise.then ; Value: ReferenceError: "global is not defined" Angular 28 AngularFireAnalytics@http://localhost:4200/vendor.js:74047:13 AngularFireAnalytics_Factory@http://localhost:4200/vendor.js:74153:182 hydrate@http://localhost:4200/vendor.js:46638:54 get@http://localhost:4200/vendor.js:46400:33 injectInjectorOnly@http://localhost:4200/vendor.js:32635:33 ɵɵinject@http://localhost:4200/vendor.js:32645:57 AngularFireAnalyticsModule_Factory@http://localhost:4200/vendor.js:74562:246 hydrate@http://localhost:4200/vendor.js:46638:54 get@http://localhost:4200/vendor.js:46400:33 R3Injector/<@http://localhost:4200/vendor.js:46330:25 R3Injector@http://localhost:4200/vendor.js:46326:31 createInjector@http://localhost:4200/vendor.js:46277:12 NgModuleRef$1@http://localhost:4200/vendor.js:63231:47 create@http://localhost:4200/vendor.js:63321:16 bootstrapModuleFactory/<@http://localhost:4200/vendor.js:68500:64 invoke@http://localhost:4200/polyfills.js:378:30 onInvoke@http://localhost:4200/vendor.js:67718:33 invoke@http://localhost:4200/polyfills.js:377:36 run@http://localhost:4200/polyfills.js:137:47 run@http://localhost:4200/vendor.js:67548:91 bootstrapModuleFactory@http://localhost:4200/vendor.js:68493:23 bootstrapModule/<@http://localhost:4200/vendor.js:68569:31 invoke@http://localhost:4200/polyfills.js:378:30 run@http://localhost:4200/polyfills.js:137:47 scheduleResolveOrReject/<@http://localhost:4200/polyfills.js:864:40 invokeTask@http://localhost:4200/polyfills.js:413:35 runTask@http://localhost:4200/polyfills.js:181:51 drainMicroTaskQueue@http://localhost:4200/polyfills.js:583:39

Expected behavior

Analytics running

Actual behavior

Whole app is not running

Workaround

By adding (window as any).global = window; to polyfill.ts I can work around the issue for now

@jamesdaniels
Copy link
Member

Thanks for the heads up, I was planning on moving the caching service to a new providedIn: 'root' module so that it's DI too. I'll address shortly.

jamesdaniels added a commit that referenced this issue Feb 6, 2020
* Brought a fix in from `5.4.2` ([#2315](#2315))
* Fixed `@angular/fire/analytics` attempting to use `global` ([#2303](#2303))
* Fix the error message on storage ([#2313](#2313))
* Starting on documentation for 6.0
@jamesdaniels
Copy link
Member

Fixed in 6.0.0-rc.1, which is being cut now

@vandres
Copy link
Author

vandres commented Feb 6, 2020

Thanks, can confirm it works without the polyfill now

@jamesdaniels
Copy link
Member

Thanks for giving the RC a spin. The feedback is super valuable!

noproblem23 added a commit to noproblem23/angularfire that referenced this issue Apr 26, 2023
* Brought a fix in from `5.4.2` ([#2315](angular/angularfire#2315))
* Fixed `@angular/fire/analytics` attempting to use `global` ([#2303](angular/angularfire#2303))
* Fix the error message on storage ([#2313](angular/angularfire#2313))
* Starting on documentation for 6.0
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

2 participants