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 because of a conflict with Google Tag Manager code #898

@aleksey-shishkevich

Description

@aleksey-shishkevich

I am getting the error
zone.js has detected that zoneawarepromise (window|global).promise has been overwritten
in my angular2 project. That happens from time to time on page reload and probably depends on connection speed. As I figured out that is caused by a conflict with gtm code. Most likely gtm script is asynchronously loading some other scripts (hot jar in my case) which can overwrite window.promise. And it does not matter where exactly these scripts were placed

The workaround which is working for me

Zone.assertZonePatched = function () {
            if (global.Promise !== ZoneAwarePromise) {
                global.Promise = ZoneAwarePromise;
            }
 };

but how safe is it?

I would be grateful for explanation and any smarter workarounds. Changing gtm code is not acceptable for me.

"zone.js": "0.7.4" (also tried v0.8.17)

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