Skip to content

fix(email): Link email images to a stable URL - #133341

Draft
sentry-junior[bot] wants to merge 1 commit into
masterfrom
fix/stable-email-image-urls
Draft

sentry-junior[bot] wants to merge 1 commit into
masterfrom
fix/stable-email-image-urls

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Images in older emails break. Email templates link images through absolute_asset_url, which builds STATIC_URL, /_static/<media_version>/…. In SaaS that is s1.sentry-cdn.com, backed by the sentryio-static bucket, which deletes every object 60 days after upload. Every deploy publishes a new media version, so an email's images disappear about 60 days after the deploy it was rendered on.

This adds a STATIC_STABLE_IMAGES_URL setting and an absolute_stable_image_url template tag (backed by get_stable_image_url). They build <STATIC_STABLE_IMAGES_URL>/<module>/images/…, a URL that stays the same across deploys. Every image in sentry/emails/ templates now uses the tag, including the {% static %} integration logos, which also rendered relative URLs in self-hosted. The Sentry email avatar uses it too.

get_stable_image_url only accepts images/ paths, because only <module>/images/ is published under the stable prefix.

When the setting is unset, the tag falls back to the versioned asset URL, so self-hosted output does not change.

Follow-ups that set the setting and publish the images:

  • getsentry: uploads <module>/images/ to _stable/ on every deploy and sets STATIC_STABLE_IMAGES_URL.
  • getsentry/ops: stops the bucket's 60-day delete rule from expiring _stable/.

getsentry's email templates switch to the new tag in its PR, so this one has to merge first.

via @hobzcalvin.

--

View Session [Sentry]

Email images used the versioned STATIC_URL. The static bucket deletes
objects 60 days after upload, so images in older emails break.

Add STATIC_STABLE_IMAGES_URL and an absolute_stable_image_url tag that
point at images published under an unversioned path, and use them for
every image in email templates and the email avatar. When the setting is
unset, the tag falls back to the versioned asset URL, so self-hosted is
unchanged.

Co-Authored-By: Grant Patterson <82265+hobzcalvin@users.noreply.github.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 3, 2026
@sentry-junior
sentry-junior Bot requested a review from hobzcalvin December 3, 2026 00:59

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant