An image URL whose upstream host has no address answers 500 and is logged as pixa's own failure #367

Closed
opened 2026-11-11 22:03:16 +01:00 by clawbot · 1 comment
Collaborator

Found while running a signed /v1/image/ request against next (0de6972).

Steps

Sign a /v1/image/ URL for cdn.example.com/photos/cat.jpg (see README Signed URLs) and request it. cdn.example.com has no DNS address.

What happened

pixa answers 500 {"error":"internal error"}. It logs failed to get image at error level, with upstream fetch failed: invalid or unresolvable host: cdn.example.com.

respondImageError in internal/handlers/image.go has no case for httpfetcher.ErrInvalidHost, so the error takes its default case. Its doc says a 500 is pixa's own failure, and that failures the client or the upstream caused are logged at warn level.

Unverified, from reading the code: every other failure of client.Do in internal/httpfetcher/httpfetcher.go that is not a timeout reaches the same default case, for example a refused connection or a failed TLS handshake.

What should happen

  • A host with no address answers 502 upstream error and is logged at warn level, like an upstream error status. So does any other failed fetch that is not a timeout.
  • README Routes lists these under 502.

Model: opus-5-5

Found while running a signed `/v1/image/` request against `next` (`0de6972`). ## Steps Sign a `/v1/image/` URL for `cdn.example.com/photos/cat.jpg` (see README Signed URLs) and request it. `cdn.example.com` has no DNS address. ## What happened pixa answers 500 `{"error":"internal error"}`. It logs `failed to get image` at error level, with `upstream fetch failed: invalid or unresolvable host: cdn.example.com`. `respondImageError` in `internal/handlers/image.go` has no case for `httpfetcher.ErrInvalidHost`, so the error takes its default case. Its doc says a 500 is pixa's own failure, and that failures the client or the upstream caused are logged at warn level. Unverified, from reading the code: every other failure of `client.Do` in `internal/httpfetcher/httpfetcher.go` that is not a timeout reaches the same default case, for example a refused connection or a failed TLS handshake. ## What should happen - A host with no address answers 502 `upstream error` and is logged at warn level, like an upstream error status. So does any other failed fetch that is not a timeout. - README Routes lists these under 502. Model: opus-5-5
Author
Collaborator

PR: #368, branch issue-367-unreachable-upstream-502.

A host with no address, and any failed fetch that is neither a timeout nor a cancellation, now answers 502 upstream error, logged at warn level. README Routes lists both under 502.

Model: opus-5-5

PR: https://git.eeqj.de/sneak/pixa/pulls/368, branch `issue-367-unreachable-upstream-502`. A host with no address, and any failed fetch that is neither a timeout nor a cancellation, now answers 502 `upstream error`, logged at warn level. README Routes lists both under 502. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#367