Skip to content

Bug: Profile images 404 due to Twitter/X avatar URL suffix/hash changes #201

@BankkRoll

Description

@BankkRoll

Profile images 404 due to Twitter/X avatar URL suffix/hash changes

Note: This only affects past tweets. Tweets posted after an avatar update will use the new image and render correctly. Old tweets using the old profile_image_url will never automatically update.

Description
When embedding tweets, profile images can return a 404 because the profile_image_url from Twitter’s syndication API points to a stale asset.

react-tweet currently renders the URL directly from the syndication response, so once the old asset is purged, the embed shows a broken avatar.

Example

// Old URL Being Returned (404s)
https://pbs.twimg.com/profile_images/xxxxxxxxxxxxxx/xxxxxxx_normal.jpg

// New URL **NOT** Being Returned  (works)
https://pbs.twimg.com/profile_images/xxxxxxxxxxxxxx/xxxxxxx_400x400.jpg

Steps to Reproduce

  1. Pick a personal / non-gold-check account and embed one of its tweets using react-tweet.
  2. Confirm the profile image renders correctly.
  3. Upgrade the account to a verified business / gold-check account.
  4. After the gold check is applied, reload the embed.
  5. Observe that the old profile_image_url now returns a 404 and the avatar is broken.

Expected Behavior

  • Avatars should always render, even if Twitter rotates the asset hash or updates the profile image.
  • The component should ensure the latest avatar is displayed for past tweets, not just the version at the time of posting.

Actual Behavior

  • Avatar requests fail with 404 for old suffix/hash.
  • The tweet embed shows a broken profile image.
  • Using URL suffix manipulations would only load the avatar that existed when the tweet was posted, not the latest profile image.

Current Workaround / Fallback

Currently, we bypass this issue by overriding the default avatar component in react-tweet.
Our custom component (SafeProfileImage) renders the original profile image URL, and if it 404s, it falls back to a known working image for the account.

Limitations:

  • Without a dynamic latest-avatar fetch, past tweets still risk pointing to stale images if the account updates its avatar again.
  • Manual updates to the fallback image are currently required to ensure the latest avatar is displayed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions