bluesky-social / social-app

The Bluesky Social application for Web, iOS, and Android
https://bsky.app
MIT License
7.88k stars 1.03k forks source link

Cannot add a link card for certain links, link card isn't loading #2734

Open hildwin opened 7 months ago

hildwin commented 7 months ago

Describe the bug I try to include a link to the website of the German parliament in a new post, and generate a link card, but it fails. I see the message "Please wait for your link card to finish loading", posting is not possible. Even after waiting a while, I can only cancel. A link card cannot be generated.

To Reproduce

Steps to reproduce the behavior:

  1. Paste the following link into the compose box https://www.bundestag.de/mediathek/live
  2. click add link card

Expected behavior Expected to have a link card generated.

Screenshots Screenshot 2024-02-02 103032_waitloading

Details

Additional context

mary-ext commented 7 months ago

Both the metadata extraction and image extraction seems to have succeeded but the app is still stuck somehow, interesting.

image


Though it doesn't seem to be a valid image? It's supposed to go on even if a local thumbnail can't be generated from the image.

Ah, seems like it got swallowed when trying to load the image.

surfdude29 commented 7 months ago

I wonder, is the behaviour different on the app to the web? I just tried to reproduce it on iOS (1.66) and no image loaded, but I was able to make the post fine with the link card:

https://bsky.app/profile/surfdude29.ispost.ing/post/3kkh5o67bhs2z

mary-ext commented 7 months ago

Slightly different, web version goes through a different code path for downloading, parsing and resizing the image

hildwin commented 7 months ago

I wonder, is the behaviour different on the app to the web? I just tried to reproduce it on iOS (1.66) and no image loaded, but I was able to make the post fine with the link card:

https://bsky.app/profile/surfdude29.ispost.ing/post/3kkh5o67bhs2z

I tried to generate a link card on Android (1.66): No image loaded, but I was able to post with link card, too.

hildwin commented 7 months ago

Checking the link with one of thousand OG-preview-sites shows no error. What is the difference with bsky? E. g. https://www.opengraph.xyz/url/https%3A%2F%2Fwww.bundestag.de%2Fmediathek%2Flive

mary-ext commented 7 months ago

It grabbed the same image URL, but the embed crawler certainly isn't liking it when it tries to download the image, we need that proxy for CORS reasons.

kainsavage commented 4 months ago

I am also experiencing this issue with the web client. I tried OP's post and it seems to be working now, but I can request a card for https://blog.teamclerks.net/post/renaissance-man/ and it will never get the image.

I checked documentation and source, but I couldn't find anything suggesting limits to size, aspect ratio, or anything else. Also, I've used cards with webp before that do work, so I know it's not a mime type issue.

I can even see the request in the network tab is trying to get the correct image: image (here's that url for copy/pasting purposes: https://cardyb.bsky.app/v1/image?url=https://blog-teamclerks-net-images.s3.amazonaws.com/500a4317-3052-4dbb-9690-de35baf9943b.webp) but even though it's a 200 response code, the response itself is a 0x0 webp image: image

EDIT1: I didn't think to actually travel to that cardyb.bsky.app link until after I wrote my initial comment. It loads an image but it's INSANE. Like, an acid trip of the actual image. Here, is just an embed of the image itself, embedded normally in this Github issue, and then what the cardyb thing renders (copied and rendered here because I didn't want to spam the service AND because it fails a similar fashion to the card fetch attempt in the Bluesky web client):

normal insane

surfdude29 commented 4 months ago

Whoa that is very trippy indeed! Maybe cardyb is having trouble with the webp to png conversion? @Jacob2161 might know what's going on

kainsavage commented 4 months ago

Definitely something strange going on. For fun I changed the format to png (since you mentioned it) and tried to pull the card again, but it failed. image image

Accessing the CardyB URL directly shows it start loading the image then quit and show a white screen with the url instead (it quits at around where it quits in that thumb from the networking tab above).

So, I don't think it's necessarily in a format conversion step... something weird about this image specifically is causing issues (and probably other images as well).

EDIT: Also - dang! Look at the difference in file size between webp and png... bananas.

surfdude29 commented 4 months ago

Accessing the CardyB URL directly shows it start loading the image then quit and show a white screen with the url instead (it quits at around where it quits in that thumb from the networking tab above).

Yeah when I download the png I get a very similar image where it just stops decoding/runs into errors part way down:

IMG_2455

So, I don't think it's necessarily in a format conversion step... something weird about this image specifically is causing issues (and probably other images as well).

Yeah hopefully Jake can shed some light on what's causing the glitches 🤞

EDIT: Also - dang! Look at the difference in file size between webp and png... bananas.

Quite a difference!