Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweet shortcode broken due to API sunsetting at twitter #8130

Closed
sharebear opened this issue Jan 10, 2021 · 4 comments · Fixed by #9106
Closed

tweet shortcode broken due to API sunsetting at twitter #8130

sharebear opened this issue Jan 10, 2021 · 4 comments · Fixed by #9106

Comments

@sharebear
Copy link

sharebear commented Jan 10, 2021

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.80.0/extended linux/amd64 BuildDate: 2020-12-31T20:02:59Z

Does this issue reproduce with the latest release?

Yes

Description

I just went to write my first blog post in over a year, and running hugo server -D failed with the following error output

ERROR 2021/01/10 23:06:51 Failed to get JSON resource "https://api.twitter.com/1/statuses/oembed.json?id=1187377527901360129&dnt=false": Failed to retrieve remote file: Not Found
If you feel that this should not be logged as an ERROR, you can ignore it by adding this to your site config:
ignoreErrors = ["error-remote-getjson"]
Built in 635 ms
Error: Error building site: logged 1 error(s)

Trying the link manually I get an error, if I strip part of the url down to https://api.twitter.com/1/statuses/ I get the following response

The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.

Luckily I only had 4 instances of the shortcode in my blog so I was able to quickly hardcode in the correct html in order to be productive, but I guess this needs to be fixed to follow the guide here https://developer.twitter.com/en/docs/twitter-for-websites/embedded-tweets/overview if I'm reading this correctly it also seems that it's no longer possible to just use the tweet id by itself.

@datawookie
Copy link

Also encountered this error, but with a slightly different error message:

ERROR 2021/02/14 09:11:30 Failed to get JSON resource "https://api.twitter.com/1/statuses/oembed.json?id=1099215039486140418&dnt=false": Get "https://api.twitter.com/1/statuses/oembed.json?id=1099215039486140418&dnt=false": read tcp 172.17.0.5:38232->104.244.42.194:443: read: connection reset by peer

When I try https://api.twitter.com/1/statuses/oembed.json?id=1099215039486140418&dnt=false manually though it works.

Seems like this might be an intermittent problem. Is there any way to add a retry to the {{< tweet >}} shortcode?

@rodrigoalcarazdelaosa
Copy link

jmooring added a commit to jmooring/hugo that referenced this issue Oct 31, 2021
The existing endpoint will be retired and removed on November 23, 2021.
References:

- https://twittercommunity.com/t/consolidating-the-oembed-functionality/154690
- https://developer.twitter.com/en/docs/twitter-for-websites/oembed-api#Embedded

This is a backward compatible change.

The existing endpoint requires a single parameter: the id of the tweet.

The new endpoint requires two parameters: the id of the tweet, and the
user with whom it is associated. For the moment, if you supply the wrong
user, the request will be redirected (with a small delay) to the correct
user/id pair. This behavior is undocumented, but we will take advantage
of it as Hugo site authors transition to the new syntax.

{{< tweet 1453110110599868418 >}} --> works, throws warning, deprecate at some point

{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}} --> new syntax

Fixes gohugoio#8130
jmooring added a commit to jmooring/hugo that referenced this issue Nov 1, 2021
The existing endpoint will be retired and removed on November 23, 2021.
References:

- https://twittercommunity.com/t/consolidating-the-oembed-functionality/154690
- https://developer.twitter.com/en/docs/twitter-for-websites/oembed-api#Embedded

This is a backward compatible change.

The existing endpoint requires a single parameter: the id of the tweet.

The new endpoint requires two parameters: the id of the tweet, and the
user with whom it is associated. For the moment, if you supply the wrong
user, the request will be redirected (with a small delay) to the correct
user/id pair. This behavior is undocumented, but we will take advantage
of it as Hugo site authors transition to the new syntax.

{{< tweet 1453110110599868418 >}} --> works, throws warning, deprecate at some point

{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}} --> new syntax

Fixes gohugoio#8130
jmooring added a commit to jmooring/hugo that referenced this issue Nov 1, 2021
The existing endpoint will be retired and removed on November 23, 2021.
References:

- https://twittercommunity.com/t/consolidating-the-oembed-functionality/154690
- https://developer.twitter.com/en/docs/twitter-for-websites/oembed-api#Embedded

This is a backward compatible change.

The existing endpoint requires a single parameter: the id of the tweet.

The new endpoint requires two parameters: the id of the tweet, and the
user with whom it is associated. For the moment, if you supply the wrong
user, the request will be redirected (with a small delay) to the correct
user/id pair. This behavior is undocumented, but we will take advantage
of it as Hugo site authors transition to the new syntax.

{{< tweet 1453110110599868418 >}} --> works, throws warning, deprecate at some point

{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}} --> new syntax

Fixes gohugoio#8130
@bep bep closed this as completed in #9106 Nov 1, 2021
bep pushed a commit that referenced this issue Nov 1, 2021
The existing endpoint will be retired and removed on November 23, 2021.
References:

- https://twittercommunity.com/t/consolidating-the-oembed-functionality/154690
- https://developer.twitter.com/en/docs/twitter-for-websites/oembed-api#Embedded

This is a backward compatible change.

The existing endpoint requires a single parameter: the id of the tweet.

The new endpoint requires two parameters: the id of the tweet, and the
user with whom it is associated. For the moment, if you supply the wrong
user, the request will be redirected (with a small delay) to the correct
user/id pair. This behavior is undocumented, but we will take advantage
of it as Hugo site authors transition to the new syntax.

{{< tweet 1453110110599868418 >}} --> works, throws warning, deprecate at some point

{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}} --> new syntax

Fixes #8130
@jmooring
Copy link
Member

jmooring commented Nov 1, 2021

We've updated the shortcode to use the new oEmbed endpoint; this will be available in the next release.

@sharebear

The failure you noted with tweed id 1187377527901360129 is not related to the API. This was simply a page not found (see https://twitter.com/x/status/1187377527901360129).

@datawookie

The failure you noted with tweet id 1099215039486140418 is not related to the API. If you continue to experience this problem, please use the forum (https://discourse.gohugo.io) for questions and troubleshooting. We prefer to use GitHub for verified bugs and vetted enhancements. Thanks.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants