Home > Back-end >  Angular zone.js - zone-evergreen.js error : t.getElementsByTagName is not a function
Angular zone.js - zone-evergreen.js error : t.getElementsByTagName is not a function

Time:12-02

I have an app on Angular 11 that just started getting errors (around an hour ago, without any update or anything) on all browsers, all environments (local / staging / prod) at the same time:

Uncaught TypeError: t.getElementsByTagName is not a function
    at computeStackTrace.js:338
    at Array.forEach (<anonymous>)
    at computeStackTrace.js:338
    at Array.forEach (<anonymous>)
    at MutationObserver.<anonymous> (computeStackTrace.js:338)
    at l.invoke (polyfills.98c82c2662d9589ab04d.js:formatted:278)
    at a.runGuarded (polyfills.98c82c2662d9589ab04d.js:formatted:119)
    at MutationObserver.<anonymous> (polyfills.98c82c2662d9589ab04d.js:formatted:98)

Our package.json dependencies:

    "dependencies": {
        "@angular-material-components/color-picker": "^5.0.0",
        "@angular-material-components/datetime-picker": "^5.0.0",
        "@angular/animations": "^11.2.14",
        "@angular/cdk": "^11.2.13",
        "@angular/common": "^11.2.14",
        "@angular/compiler": "^11.2.14",
        "@angular/core": "^11.2.14",
        "@angular/forms": "^11.2.14",
        "@angular/material": "^11.2.13",
        "@angular/platform-browser": "^11.2.14",
        "@angular/platform-browser-dynamic": "^11.2.14",
        "@angular/router": "^11.2.14",
        "@ngx-translate/core": "^13.0.0",
        "@ngx-translate/http-loader": "^6.0.0",
        "@sentry/angular": "^6.7.1",
        "@sentry/integrations": "^6.7.2",
        "@sentry/tracing": "^6.7.1",
        "@swimlane/ngx-charts": "^16.0.0",
        "amplitude-js": "^7.3.1",
        "bootstrap": "^4.5.3",
        "flag-icon-css": "^3.5.0",
        "http-status-codes": "^1.4.0",
        "jspdf": "^2.3.1",
        "jwt-decode": "^2.2.0",
        "libphonenumber-js": "^1.9.36",
        "lodash": "^4.17.21",
        "messageformat": "^2.3.0",
        "ng2-pdfjs-viewer": "^6.0.1",
        "ngx-kjua": "^1.12.3",
        "ngx-mat-select-search": "^3.3.0",
        "ngx-translate-messageformat-compiler": "^4.9.0",
        "rxjs": "^6.6.3",
        "slugify": "^1.5.3",
        "tslib": "^2.0.0",
        "zone.js": "~0.10.2"
    },

We tried several things (even upgrading to Angular 12 locally, the error's still there), nothing works :(

Anyone has already seen something like that?

CodePudding user response:

Solved! After 2 hours, we finally found the culprit: a Hubspot (CRM) script imported in index.html ... (apparently it broke the HTML structure)

We removed the <script> tag, everything went back to normal instantly... Leaving this here in case someone has the same problem someday!

CodePudding user response:

The issue is now fixed according to HubSpot: https://community.hubspot.com/t5/APIs-Integrations/t-getElementsByTagName-is-not-a-function-from-https-js/m-p/534903

My project was facing the same issue and last time we saw it in production was 1:10pm EST.

  • Related