Repository navigation
feat(api): proxy STREAMS_URL through API for desktop - #1386
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds a server-side proxy route at Changes
Sequence DiagramsequenceDiagram
participant Desktop as Desktop Client
participant APIServer as API Server (/api/streams)
participant StreamsSvc as Upstream Streams Service
Desktop->>APIServer: Request to /api/streams/...
APIServer->>APIServer: Validate session (Superset)
APIServer->>APIServer: Filter headers, rewrite path
APIServer->>StreamsSvc: Forward request to env.STREAMS_URL
StreamsSvc-->>APIServer: Response (status, headers, body)
APIServer-->>Desktop: Proxy response (preserve status, headers, body)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
Route desktop streams traffic through the API (`/api/streams/...`) instead of connecting directly to the streams server. This eliminates the need to bundle STREAMS_URL in desktop builds, allowing the streams server URL to be updated without shipping a new desktop release.
6108fec to
597b5c2
Compare
Summary
/api/streams/...) instead of connecting directly to the streams serverSTREAMS_URLin desktop builds — the streams server URL can now be updated without shipping a new desktop release/api/electric/v1/shape)Changes
API (
apps/api)STREAMS_URLto API env schema (env.ts)api/streams/[...path]/route.ts— authenticates via session, forwards allowlisted headers, streams request/response bodies, setsmaxDuration = 300for long-lived connectionsDesktop (
apps/desktop)getConfigandsession-managerto use${NEXT_PUBLIC_API_URL}/api/streamsinstead ofSTREAMS_URLSTREAMS_URLfromenv.main.ts, CSP inindex.html,htmlEnvTransformPlugin, and VitedefineconfigCI & Build
STREAMS_URLfrombuild-desktop.yml,ci.yml,deploy-preview.ymlworkflowsSTREAMS_URLfromturbo.jsoncglobalEnvTest Plan
bun run typecheck— passes (18/18 packages)bun run lint:fix— passes, no fixes neededbun test— passes (1224 pass, 0 fail)bunx sherif --fix— no issues foundlocalhost:3001/api/streams/v1/...Summary by CodeRabbit
New Features
Chores