Skip to content
New issue

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

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

Already on GitHub? # to your account

Embedding tweets breaks when the account goes private #248

Open
richburroughs opened this issue Nov 16, 2022 · 6 comments
Open

Embedding tweets breaks when the account goes private #248

richburroughs opened this issue Nov 16, 2022 · 6 comments

Comments

@richburroughs
Copy link

Describe the bug
It looks like embedded tweets fail when the account goes private. We use Netlify and our build broke.

I know the person who had made the tweet and she did go private for a bit right before we got the error.

We saw this in the logs:

ERROR 2022/10/31 16:38:49 Failed to get JSON resource "https://api.twitter.com/1/statuses/oembed.json?hide_thread=1&id=1334188913724850177": Failed to retrieve remote file: Forbidden, body: "{"error":"Sorry, you are not authorized to see this status.","request":"\/1\/statuses\/oembed.json?hide_thread=1&id=1334188913724850177"}"

To Reproduce
Steps to reproduce the behavior:

  1. Embed a tweet
  2. Set the Twitter account to private
  3. See error

Expected behavior

Something less brittle. I think I'd probably expect it to just not display the tweet but log something.

On a related topic, I expect more people will be deleting accounts too with everything happening there at Twitter, too. Not sure how the code handles that.

@spences10
Copy link
Collaborator

Yeah, good point @richburroughs maybe something in the twttrLoad, util.ts method to gracefully close out the component!

https://github.com/PaulieScanlon/mdx-embed/blob/main/packages/mdx-embed/src/components/twitter/utils.ts#L7

feel free to contribute if you have another suggestion or discuss it further here.

@PaulieScanlon I presume you're of the same opinion on the suggested approach here?

@PaulieScanlon
Copy link
Owner

Hi @richburroughs could you provide the full tweetLink including the username so i can see what you were seeing.

I'm currently working on upgrading MDX Embed to use MDX 2 and will investigate this issue after i've completed the upgrade.

@PaulieScanlon
Copy link
Owner

@spences10 thanks babes 😘

@richburroughs
Copy link
Author

The link wouldn't help as the person is no longer private. They had just gone private for a few days.

It should be easy to duplicate though by linking to a tweet from any other private account.

Thanks :)

@PaulieScanlon
Copy link
Owner

Thanks @richburroughs do you have a link to a Tweet from a private account to help me reproduce?

@richburroughs
Copy link
Author

Hey Paulie,

Sure, here's one:

https://twitter.com/giflian/status/1605757037455216640

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants