Skip to content

Setting __Zone_disable_ZoneAwarePromise to true throws error #37349

@RatkoR

Description

@RatkoR

🐞 bug report

Affected Package

zone.js

Is this a regression?

I tried with angular 8 on stackblitz and it also throws Error.

Description

Setting __Zone_disable_ZoneAwarePromise = true; should disable zonejs patching of Promise.then. Instead, it throws Promise has beed overwritten error and stops.

🔬 Minimal Reproduction

Just add __Zone_disable_ZoneAwarePromise = true; to index.html as per documentation.

https://stackblitz.com/edit/angular-bazsff

🔥 Exception or Error


Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.

from packages/zone.js/lib/zone.ts::assertZonePatched.

🌍 Your Environment

Angular Version:


Angular CLI: 9.1.6
Node: 10.15.3
OS: linux x64

Angular: 9.1.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, upgrade
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.6
@angular-devkit/build-angular     0.901.6
@angular-devkit/build-optimizer   0.901.6
@angular-devkit/build-webpack     0.901.6
@angular-devkit/core              9.1.6
@angular-devkit/schematics        9.1.6
@angular/cdk                      9.2.1
@angular/cli                      9.1.6
@ngtools/webpack                  9.1.6
@nguniversal/builders             9.1.1
@nguniversal/common               9.1.1
@nguniversal/express-engine       9.1.1
@schematics/angular               9.1.6
@schematics/update                0.901.6
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

zone.js: 0.10.3

Anything else relevant?

Polyfills.js states that only 3 variables have affect:

  • __Zone_disable_requestAnimationFrame
  • __Zone_disable_on_property
  • __zone_symbol__UNPATCHED_EVENTS

If this is true, than maybe you only need to fix zonejs documentation, because it mentions a lot of other flags, __Zone_disable_ZoneAwarePromise being one of them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: zonesIssues related to zone.js

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions