prql icon indicating copy to clipboard operation
prql copied to clipboard

fix: tolerate Twitter CDN failures in web testimonials build

Open prql-bot opened this issue 5 months ago • 0 comments

Problem

build-web failed on main (run 27255107833) with a Hugo render error:

error calling GetRemote: Get "https://pbs.twimg.com/profile_images/1433982028/profile_normal.png": net/http: request canceled (Client.Timeout exceeded while awaiting headers)

section-testimonials.html downloads each testimonial's Twitter avatar at build time via resources.GetRemote. Per the Hugo docs, "if you do not handle the error yourself, Hugo will fail the build" — and only a 404 returns nil (the case the existing {{ with }}/{{ else }} handled). Any other HTTP request error, including a timeout, hard-fails the whole build. So a single slow or unreachable Twitter CDN fetch aborts build-web. The default image fetch on the line above had no error handling at all.

Solution

Wrap both remote fetches (the shared default image and each per-author avatar) in Hugo's try statement and inspect .Err. A failed fetch now logs a warnf and falls back instead of failing the build. A transparent 1×1 data-URI is the ultimate fallback, so the build no longer hard-depends on Twitter's CDN being reachable.

When the network is healthy the behavior is unchanged — real avatars are still downloaded and cached locally (which is why they're downloaded in the first place: Firefox tracking protection blocks pbs.twimg.com images for end users).

try is available since Hugo v0.141.0; the build-web job installs latest, so it's supported.

Testing

Reproduced and verified locally with Hugo v0.157.0 extended on a copy of web/website, pointing one testimonial at an unreachable host to force an HTTP request error:

  • Before: build fails with the exact CI error shape — section-testimonials.html:61:37 ... error calling GetRemote: ... connect: connection refused.
  • After: build succeeds (exit 0). The unreachable avatar emits WARN [section-testimonials.html] couldn't fetch remote image ... and renders /default.png; the other testimonials still fetch and cache their real pbs.twimg.com avatars normally.

Automated fix for failed run

prql-bot avatar Jun 10 '26 05:06 prql-bot