Social media previews no longer work

Platform: website

Browser, if a website issue: n/a

URLs (aka web addresses) of any relevant observations or pages: any page with useful opengraph tags (e.g. individual observations)

Description of problem:

Recently, social media previews started breaking. This can be demonstrated with curl as follows.

$ curl -sL 'https://www.inaturalist.org/observations/346061535' | grep 'og:image'

What is expected here is that the meta tags for the observation that are used by social media platforms to generate a preview card for the page should be included in the page, e.g.

<meta content="https://inaturalist-open-data.s3.amazonaws.com/photos/630757989/large.jpg" property="og:image">

What happens instead is a challenge page is shown. No social media preview (Discord, etc.) will be shown as a result when an iNaturalist page is linked to. Those platforms are non-interactive like this curl request that simulates the issue, and therefore can’t answer the challenge.

1 Like

Thank you for reporting this issue.

It should be fixed now, but it could take some time to roll out everywhere (some social media tools may have cached the error and will only retry in a few minutes/hours/days)

5 Likes

I’m seeing failure to preview images for brand new URLs that Discord would not have seen before still happening today.

For example here’s one that was posted less than an hour ago for an observation that was only just made a short while ago. Surely Discord couldn’t be hanging on to old results:

https://www.inaturalist.org/observations/346573881

Maybe the fix didn’t take? (yet?)

1 Like

This is what I get back from curl (manually rewrapped and <script> and <style> stripped out):

$ curl -sL https://www.inaturalist.org/observations/346573881
<!DOCTYPE html><html lang="en-US">
<head><title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="robots" content="noindex,nofollow">
<meta name="viewport" content="width=device-width,initial-scale=1">
…
<meta http-equiv="refresh" content="360"></head><body><div class="main-wrapper" role="main">
<div class="main-content">
  <noscript>
    <div class="h2"><span id="challenge-error-text">Enable JavaScript and cookies to continue</span>
    </div>
</noscript></div></div>
…
</body></html>

So maybe that’s a case that wasn’t considered in the fix? Social media previewers aren’t going to have Javascript and cookies enabled, I bet.

I looked for code in the iNaturalist github repo related to the fix that was supposedly implemented and couldn’t find any. Perhaps the fix was a configuration change only for Cloudfront, not a code change?

In any case, is there anything else I can do to help move this forward? It has been two weeks since the issue was reported as fixed, but I quickly found that it isn’t actually fixed, at least not for Discord image previews. I have a workaround in place for Dronefly bot, but it only addresses a fraction of the problem for a fraction of iNaturalist users:

  • Only some users benefit: there are many other people who use iNaturalist who use Discord, but not our bot
  • To stay within iNat rate limits, Dronefly bot only previews a single observation link per message, and that limit also applies to our workaround. Before this broke, Discord would show preview images for several observation links in the same message, something the bot is too constrained by API limits to be able to handle on its own.
  • There is a potential impact on social media platforms other than Discord. But Discord is the only one I use, so I don’t know how far-reaching this problem is.
2 Likes