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

Error because of a conflict with Google Tag Manager code #898

Closed
aleksey-shishkevich opened this issue Sep 11, 2017 · 0 comments · Fixed by #899
Closed

Error because of a conflict with Google Tag Manager code #898

aleksey-shishkevich opened this issue Sep 11, 2017 · 0 comments · Fixed by #899

Comments

@aleksey-shishkevich
Copy link

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant