fix(relay): wrap non-JSON upstream errors in JSON envelope#1700
Open
NewCoder3294 wants to merge 1 commit intokoala73:mainfrom
Open
fix(relay): wrap non-JSON upstream errors in JSON envelope#1700NewCoder3294 wants to merge 1 commit intokoala73:mainfrom
NewCoder3294 wants to merge 1 commit intokoala73:mainfrom
Conversation
When upstream services (Cloudflare, nginx) return HTML error pages
(502/503), the relay handler passed them through with the original
content-type. Clients expecting JSON would fail to parse the response,
causing silent panel failures in the desktop app.
Extracts a buildRelayResponse() helper that detects non-JSON error
responses and wraps them in a { error, status } JSON envelope. Success
responses and JSON error responses pass through unchanged.
Applies the same fix to the telegram-feed handler which had an
identical passthrough pattern.
Ref koala73#976
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@NewCoder3294 is attempting to deploy a commit to the Elie Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buildRelayResponse()helper that wraps non-JSON error responses in a{ error, status }JSON envelopetelegram-feed.jswhich had an identical passthrough patternChanges
api/_relay.js— newbuildRelayResponse()helper, replaces inline Response constructionapi/telegram-feed.js— inline non-JSON error wrapping guardtests/relay-helper.test.mjs— 44 new adversarial testsTest plan
text/html;charset=utf-8, uppercaseAPPLICATION/JSON,vnd.api+json, empty, multipart), all non-2xx status codes (400-599), body edge cases (empty, 120KB HTML, null), fallback interaction (onlyOkprecedence), header preservation, and JSON envelope integrityRef #976
🤖 Generated with Claude Code