Sharing link to Facebook does not show image (open graph)

I looked around, but can’t seem to find an answer.
I tried sharing some topics from this forum to Facebook as a test, but none of them show the image. Type of errors I get:

Provided og:image URL
https://d11a6trkgmumsb.cloudfront.net/optimized/4X/e/0/4/e04203d665f3ff3540361fdeedb76df8cf37df9b_2_1024x767.jpeg could not be processed as an image.
It may be corrupted or may have an invalid format.
Could not resolve the hostname into a valid IP address.

Anyone lucky enough to share topics and Facebook showing the image properly?

I would love to help except I can’t discern ANY conceivable improvement that we could possibly do here.

The URL is good:

If Facebook can’t resolve a DNS name that belongs to Amazon CloudFront, that’s a Facebook failure. Perhaps they’re having internal troubles?

Or, possibly Amazon, but that’s less likely.

What does Facebook support say about this?

I’m a bit confused about the image you shared…?

To my knowledge, Facebook “support” doesn’t even exist.

But this doesn’t seem to be a Facebook issue, because on my own Discourse installation, some images are shown, so I would just like to know what’s the process to make them work? Is the first image in the topic? If so, why would that topic from this very forum not work (along with others I tried), but for mine it did?

Maybe this will be a mystery to be unsolved.

That’s the image URL to which you were referring in the OP.

The flow for this process is:

  • User posts the topic URL to Facebook
  • Facebook retrieves the topic URL and parses the opengraph tags
  • Facebook identifies the og:image URL
  • Facebook attempts to retrieve the og:image URL
    • Facebook resolves the URL’s hostname into an IP address
    • Facebook connects to the IP
    • Facebook retrieves the URL

If it’s trying to retrieve the URL https://d11a6trkgmumsb.cloudfront.net/optimized/4X/e/0/4/e04203d665f3ff3540361fdeedb76df8cf37df9b_2_1024x767.jpeg but gives the error Could not resolve the hostname into a valid IP address. Discourse is not in the path for that step of the process. It’s Facebook’s servers trying to resolve an Amazon Cloudfront hostname.

Ok, that makes sense now. Thank you.

I was just wondering if something could be wrong with how Discourse was picking the images and setting the og:image. But yes, if my Discourse works (even though not 100% perfect), then maybe something is wrong with what you said.

So, my question still is: the image being picked is always the topmost image in the topic? Is it how Discourse it built? Or is it randomly picked? And are there any specific requirements for it to pick the image in terms of image dimensions, etc? Just want to make sure that when it comes to my own topics, if I want to include images, I format them properly.

May not be the best place for this brief documentation, but you can use a |thumbnail hint in your image Markdown to choose a different thumbnail:

1 Like

Thank you so much for the tip. Didn’t know about it.
How about image dimensions? Any requirements? Or any image will be used, even if it gets distorted by being resized?

EDIT: I just noticed that this is a component… so I have to install the component in order to decide which image will be used by OpenGraph? I’m a bit confused now, sorry.

I’m not sure, but I think any image can be used, and resizing is up to the consumer. For example, I just tested a small image on try, let’s see its Onebox:

It is a bit confusing indeed, the |thumbnail logic is all on core, the theme component just requests that core generates additional thumbnail sizes, and uses them on the topic list. It happened to be the only topic (that I know of) with that piece of information, hence the quote.

When I tested on Facebook Debugger, I got some errors and no image is displayed

Thank you for clarifying. I am definitely installing this component, because it’s a feature I really want to use on some categories. I also checked a similar component, the Topic Cards. This one seems to have its own strengths as well.