ob1234
#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?
wizjo
#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?
ob1234
#3
Hey. I created a test post located here: éòìåï òì úé÷ 3000: þàéï ìé ñô÷ ùäéä ôä îäìê îëååï ìà ééúëï ùðúðéäå ìà éãò, äéä òìéå ìäúôèø - çãùåú øåèø
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
Hi @ob1234,
Can you try loading widgets.js over https and see if that fixes the issue?
ob1234
#7
it didn’t solve the problem for 100% of the time. still sometimes it works and sometimes it doesnt.
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.
ob1234
#9
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?
ob1234
#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
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!
ob1234
#13
that doesn’t seem to work… i get the following error:
Uncaught ReferenceError: twttr is not defined
ob1234
#14
Hi
Any update on this issue?
Ory
ob1234
#15
Hey, any update on this issue?
There was a fix deployed recently that I hope addressed your problem.
1 Like
ob1234
#17
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'
}
);
ob1234
#19
Seems to work now, I’ll continue to monitor it. thanks!
system
Closed
#20
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.