Skip to content

fix: stop embedding upstream response bodies in upload errors#916

Closed
rareboe wants to merge 1 commit into
productionfrom
fix/upload-attachment-error-body
Closed

fix: stop embedding upstream response bodies in upload errors#916
rareboe wants to merge 1 commit into
productionfrom
fix/upload-attachment-error-body

Conversation

@rareboe

@rareboe rareboe commented Jun 12, 2026

Copy link
Copy Markdown

Summary

  • Slack was receiving upload-attachment errors whose message embedded a raw HTML page: when an upload exceeds the game server's Cloud Run ingress cap (32 MiB per HTTP/1 request), the upstream 413 response is the Google front-end's HTML error page, and api.upload-attachment.ts embedded the whole body into the thrown message → { success: false, error: "Upload failed: 413 <html>..." } reached user toasts and Slack
  • Log a truncated (500 chars) copy of the upstream body server-side for debugging, and throw a clean Storage upload rejected (<status>) message instead
  • Pairs with planetarium/agent8-frontend#432 (client-side pre-validation: image 10MB / others 30MB) so oversized files are blocked before ever reaching the game server; any 413 that still slips through keeps reporting to Slack with a readable message

Test plan

  • pnpm typecheck, eslint on the changed file pass
  • Upload a >32MiB file directly against the API → JSON error with Storage upload rejected (413), no HTML

🤖 Generated with Claude Code

When the game server's Cloud Run ingress rejects an oversized upload
(32 MiB HTTP/1 request cap), the upstream 413 response is a Google
front-end HTML error page. Embedding it in the thrown message leaked
raw HTML into user-facing toasts and Slack reports. Log a truncated
copy server-side for debugging and throw a clean status-based message
instead.
@rareboe

rareboe commented Jun 12, 2026

Copy link
Copy Markdown
Author

Wrong repo — agent8 no longer serves the backend; re-submitting against agent8-backend.

@rareboe rareboe closed this Jun 12, 2026
@rareboe rareboe deleted the fix/upload-attachment-error-body branch June 12, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant