Console error with embedded tweet on website

I’m getting a console error Uncaught TypeError: Cannot read property ‘appendChild’ of null on our website as of yesterday. I’m pretty sure nothing has changed on the site that would cause this.
Here’s an example:

We are getting the same issue… No changes on our website. https://news.un.org/en/story/2019/09/1045642

Try moving your widgets.js reference to the footer/bottom of the page instead of the top. That seems to work for us.

Thank you. We will test that.

Was using a basic script call to the widgets.js library.

<script src="https://platform.twitter.com/widgets.js"></script>

Switched to the more robust script in the documentation and this resolved the issue for our team

<script>window.twttr = (function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0],
    t = window.twttr || {};
  if (d.getElementById(id)) return t;
  js = d.createElement(s);
  js.id = id;
  js.src = "https://platform.twitter.com/widgets.js";
  fjs.parentNode.insertBefore(js, fjs);

  t._e = [];
  t.ready = function(f) {
    t._e.push(f);
  };

  return t;
}(document, "script", "twitter-wjs"));</script>

This is really helpful dustinrhod_es!.

Hi all, thanks for the report. We think this bug was caused by a recent deploy. We’re investigating a longer term bug-fix at the moment, but in the meanwhile, we’re going to roll back the offending change first. Thanks for your patience.

Great… thanks. We have our hotfix ready, we were testing it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.