Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

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

Closed
@bdunn44

Description

@bdunn44

Using:

  • Angular 2.1.0
  • Zone.js 0.6.26
  • Angular Universal 2.1.0-rc.1
  • Webpack 2.1.0-beta.25

I'm receiving the following error from Zone.assertZonePatched():

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

I referred to Angular issue #11650, but I get this error regardless of how late I import Zone.js, or if I remove the import altogether. I'm not using Bing as mentioned in #465 and I've checked all of the SO answers as well.

I've manually checked that window.Promise does in fact look to be patched (using toString, JSON.stringify, and the helper method here), so only thing I can think of is that Zone is being loaded twice, but should't this catch that?

To workaround the issue I've added a very hacky line of code to assertZonePatched to just re-patch the thing:

    static assertZonePatched() {
      window.Promise = ZoneAwarePromise;
      ...
    }

Everything seems to work correctly, but I'm thinking this probably isn't stable, otherwise you guys would have patched window.Promise at that point in the lifecycle to begin with. Any guidance would be appreciated.

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