3

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?

Yoh
  • 316
  • 3
  • 9

2 Answers2

4

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!

Yoh
  • 316
  • 3
  • 9
  • How did you reimplement hubspot? – Mike Becatti Dec 01 '21 at 16:17
  • 1
    We did not re-implement it yet, we'll wait for the error to be fixed on their side (I guess they updated something this afternoon). We only use it for chat support, but our clients have a phone number to contact us until it's back – Yoh Dec 01 '21 at 16:37
  • Yeah we are not a fan of their library at all. I prefer intercom over hubspot for their chat by far. Their scripts should not be loaded dynamically over their cdn. Instead we should have a library that we use and an access key like very other chat client out there. – Mike Becatti Dec 01 '21 at 18:11
2

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 December 1st, 2021 1:10pm EST.

Felipe Plets
  • 7,230
  • 3
  • 36
  • 60