chore(api): remove legacy Vercel electric proxy#3637
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
💤 Files with no reviewable changes (6)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughRemoved Electric sync integration: proxy route and utilities, related env vars and dependency, workflow secrets for deployments, and Electric-specific CORS headers; also bumped minimum desktop version to 1.5.0. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant DB
participant Electric
Client->>API: GET /api/electric/...
alt Before change
API->>DB: buildWhereClause / auth checks
API->>Electric: proxy request (includes ELECTRIC_* env & protocol params)
Electric-->>API: proxied response (sync headers)
API-->>Client: proxied response
else After change
API-->>Client: 404/route removed or direct handling (no proxy)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Greptile SummaryThis PR removes the legacy Vercel-hosted Electric sync proxy ( Key changes:
Confidence Score: 5/5Safe to merge — clean removal of dead code with no remaining references and an intentional version gate to protect the migration. All Electric references have been scrubbed from the codebase (confirmed by grep), the CI secrets are consistently removed from both preview and production workflows, the lockfile is updated, and the version bump is deliberately designed to force old clients off the now-deleted proxy. No logic bugs or partial removals were found. apps/api/src/app/api/desktop/version/route.ts — the 0.0.48 → 1.5.0 version bump is a very large jump that will show the update screen to every desktop user below 1.5.0; verify that desktop 1.5.0 is already in production before merging.
|
| Filename | Overview |
|---|---|
| .github/workflows/deploy-preview.yml | Removes ELECTRIC_URL top-level env var definition and ELECTRIC_URL/ELECTRIC_SECRET from the Vercel API deploy step — clean and consistent with the proxy removal. |
| .github/workflows/deploy-production.yml | Removes ELECTRIC_URL/ELECTRIC_SECRET from the production Vercel API deploy step — mirrors the preview workflow change. |
| apps/api/package.json | Removes @electric-sql/client dependency; no remaining consumers of this package found in the codebase. |
| apps/api/src/app/api/desktop/version/route.ts | Bumps MINIMUM_DESKTOP_VERSION from 0.0.48 → 1.5.0 to force legacy proxy users to update; large jump affects all clients between the two versions. |
| apps/api/src/app/api/electric/[...path]/route.ts | Deleted — the authenticated Electric sync proxy route is fully removed along with its JWT/session auth, org membership check, and column filtering logic. |
| apps/api/src/app/api/electric/[...path]/utils.ts | Deleted — where-clause builder for all Electric-synced tables removed; no remaining references to this utility. |
| apps/api/src/env.ts | Removes ELECTRIC_URL, ELECTRIC_SECRET (required), and ELECTRIC_SOURCE_ID/SECRET (optional) from server env schema; startup will no longer fail if these vars are absent. |
| apps/api/src/proxy.ts | Removes X-Electric-Backend from allowed CORS headers and six electric-* headers from exposed CORS headers; remaining headers are Durable Streams headers only. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Before["Before (removed)"]
DC1["Desktop/Mobile Client\n(< 1.5.0)"] -->|"GET /api/electric/[...path]"| EP["Vercel API\nElectric Proxy\n(auth + org check)"]
EP -->|"Proxied request\n+ secret"| FLY["Fly.io Electric\nInstance"]
end
subgraph After["After (retained)"]
DC2["Desktop/Mobile Client\n(>= 1.5.0)"] -->|"NEXT_PUBLIC_ELECTRIC_URL"| CF["Cloudflare Worker\napps/electric-proxy"]
CF --> FLY2["Fly.io Electric\nInstance"]
DC2 -->|"< 1.5.0 → blocked"| VER["Vercel API\n/api/desktop/version\n(MINIMUM_DESKTOP_VERSION = 1.5.0)"]
end
Reviews (1): Last reviewed commit: "chore(api): remove legacy Vercel electri..." | Re-trigger Greptile
The Vercel-hosted `/api/electric/*` route is no longer used by supported desktop clients. Bumps minimum desktop version to 1.5.0 (the first release after 2026-04-10) so any lingering client on a pre-1.5.0 build is forced to update before it can heartbeat against an endpoint that's about to disappear. Drops the route, its env vars (ELECTRIC_URL/SECRET/SOURCE_*), `@electric-sql/client` dep, Electric CORS headers, and the matching env passthroughs in the Vercel deploy workflows. The Cloudflare worker (apps/electric-proxy) and Fly-hosted Electric instance stay intact.
490d754 to
c42e268
Compare
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
/api/electric/[...path]route from the Vercel api, along with its env vars (ELECTRIC_URL,ELECTRIC_SECRET,ELECTRIC_SOURCE_ID,ELECTRIC_SOURCE_SECRET),@electric-sql/clientdep, and Electric-specific CORS headers.MINIMUM_DESKTOP_VERSIONfrom0.0.48→1.5.0(first release after 2026-04-10) so any client old enough to still be hitting this proxy is forced to update first.ELECTRIC_URL/ELECTRIC_SECRETpassthroughs from the Vercel api deploy steps indeploy-production.ymlanddeploy-preview.yml.The Cloudflare worker (
apps/electric-proxy), the Fly-hosted Electric instance, andNEXT_PUBLIC_ELECTRIC_URLused by desktop/mobile to reach the worker are all untouched.Test plan
ELECTRIC_*env vars< 1.5.0sees the update-required screen on launch>= 1.5.0boots and syncs via the Cloudflare worker as beforeSummary by cubic
Removed the legacy Vercel
/api/electric/*proxy and raised the minimum desktop version to 1.5.0 so older clients update before the endpoint is removed; the Cloudflare worker proxy and Fly-hosted Electric remain.Refactors
apps/api/src/app/api/electric/[...path]/*.ELECTRIC_*server envs and deploy workflow passthroughs; trimmed Electric-specific CORS headers.@electric-sql/clientfromapps/api/package.jsonand lockfile.Migration
>= 1.5.0; older versions see the update-required screen.ELECTRIC_URL/ELECTRIC_SECRET.Written for commit c42e268. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Chores