Repository navigation
fix(desktop): forward bundled-client API requests to the local backend - #15
Merged
Merged
Conversation
Packaged builds serve t3code://app from bundled assets, and that handler answered every non-GET request with 405. Desktop GitHub login posts to /api/user/auth/github/desktop/start through that origin, so sign-in failed with "Failed to start GitHub login (405)". Forward /api/* to the local backend once its origin is known, and return a JSON 503 while no local backend is running. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Desktop GitHub sign-in fails with "Failed to start GitHub login (405)" on nightly builds.
Cause
KamiCode's desktop user auth sends
/api/user/*requests same-origin throught3code://app, so Electron's main-process cookie jar holds the user session. Upstream pingdotgg#9194 changed packaged builds to servet3code://appfrom bundled assets (serveDesktopAsset), which answers every non-GET request with 405 and never reaches the backend.POST /api/user/auth/github/desktop/startwas hitting that file server.Confirmed on an installed
0.1.10-nightly.20260915.632: a direct POST to the local backend returns 401 (the route exists), and the backend trace shows no request from the app's click.Fix
ElectronProtocolgainssetLocalBackendOrigin. In bundled-asset mode,/api/*is forwarded to the local backend with the same proxy dev mode uses. It returns a JSON 503 while no local backend is running. All other paths are still served from disk.DesktopAppsets the origin once the backend endpoint is resolved.Verification
vp test run apps/desktop/src/electron/ElectronProtocol.test.ts: 9/9 passvp fmt --checkandvp linton touched files; desktoptsc --noEmithas no errors🤖 Generated with Claude Code