Twitter embeds not working 99% of the time


#1

Hey

Since 3 months ago my twitter embeds stopped working about 99% of the time (it does work for 1% of the time, after many refreshes and such)

This is the current error I see:
Uncaught (in promise) TypeError: Cannot read property ‘promise’ of undefined
at Object.o [as settingsLoaded] (widgets.js:9)
at s (widgets.js:9)
at Object.a [as isBucketed] (widgets.js:9)
at i (tweet.3f0c77e9c86dd5bae672ba9948814692.js:1)
at t. (tweet.3f0c77e9c86dd5bae672ba9948814692.js:1)
at t.hydrate (widgets.js:9)
at i.hydrate (widgets.js:8)
at widgets.js:8
at Array.forEach ()
at widgets.js:8ball:

I removed all other JS scripts I had on the page and error persists. Any idea?


#2

Hi there! Thanks for reporting this issue. Since I cannot reproduce locally with any embedded Tweet, could you share a link to your site, and the browser environment where you are experiencing this issue?


#3

Hey. I created a test post located here: http://rotter.net/ory.html
I removed all JS scripts from the page and left only widgets.js
refresh it many times, you’ll see for yourself that sometimes the embed works and sometimes it returns the error i mentioned.

it happens on all browsers, both desktop & mobile


#4

hey, any update on this?


#5

please? any help?


#6

Hi @ob1234,

Can you try loading widgets.js over https and see if that fixes the issue?


#7

it didn’t solve the problem for 100% of the time. still sometimes it works and sometimes it doesnt.


#8

Is there any way you could help us to help you to narrow this down?

  • provide links to your sites where this is an issue for you
  • provide more information about specifically what is happening
  • provide data on the platforms and browsers where you are encountering the issue

“It doesn’t work 100% of the time” is not really enough to help us to help you debug, so the more specific you can be, the more likely we may be to provide good advice.


#9

few examples:
http://rotter.net/forum/scoops1/458420.shtml
http://rotter.net/forum/scoops1/458364.shtml
http://rotter.net/forum/scoops1/458373.shtml
http://rotter.net/forum/scoops1/458328.shtml

you need more links?

it happens on all platforms/browsers. i made many tests.


#10

Does this problem happen for you on other websites where Tweets are embedded? (Like this article). Or is the problem only on your own website?


#11

i don’t browse many other websites, i have seen that problem only on my site.
on the article you provided it did work


#12

We may have an idea of what’s happening, it looks like a timing issue. It may be because you are synchronously adding the widgets.js script, which is something we do not recommend. Normally you can use use async to your script tag but you also use the factory javascript apis (twttr.widgets.createTweet), so I recommend you use our async script template.

i.e.

<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>
<script>
twttr.ready(function () {
  twttr.widgets.createTweet(
		  '971659711429955585',
		  document.getElementById('twtcon-971659711429955585'),
		  {
		    theme: 'white'
		  }
		);
});
</script>

Hope that workaround helps. We are working on a fix on our end but it is complicated and might take longer. Sorry about that!


#13

that doesn’t seem to work… i get the following error:
Uncaught ReferenceError: twttr is not defined


#14

Hi

Any update on this issue?

Ory


#15

Hey, any update on this issue?


#16

There was a fix deployed recently that I hope addressed your problem.


#17

There’s still a problem.

the error now is (chrome):
Refused to execute script from ‘https://cdn.syndication.twimg.com/tweets.json?next_version=true&callback=__twttr.callbacks.cb0&ids=971469815767552001%3Fs%3D21&lang=en&suppress_response_codes=true&tz=GMT%2B0300’ because its MIME type (’’) is not executable, and strict MIME type checking is enabled.

and for firefox:

Loading failed for the with source “https://cdn.syndication.twimg.com/tweets.json?next_version=true&callback=__twttr.callbacks.cb0&ids=971439046055653381%3Fs%3D21&lang=en&suppress_response_codes=true&tz=GMT%2B0300”.

you can check it by entering the links i provided in my previous messages


#18

That’s probably because there’s a weird ?s21 in your code. I don’t quite know how you got that.

twttr.widgets.createTweet(
  '971420340462194688?s=21',
  document.getElementById('twtcon-971420340462194688?s=21'),
  {
    theme: 'white'
  }
);

Remove ?s=21 and that should hopefully take care of it.

twttr.widgets.createTweet(
  '971420340462194688',
  document.getElementById('twtcon-971420340462194688?s=21'),
  {
    theme: 'white'
  }
);

#19

Seems to work now, I’ll continue to monitor it. thanks!


#20

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