fix: bump http-proxy-middleware to v4#2461
Conversation
Upgrade from ^3.0.5 to ^4.0.0, which replaces the http-proxy engine with httpxy (many upstream fixes, HTTP/2 support, better performance). v4 is ESM-only, so the static import in clickhouseProxy.ts is replaced with a lazy dynamic import() wrapper that caches after first call.
🦋 Changeset detectedLatest commit: c0d00d5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryBumps
Confidence Score: 5/5Safe to merge — the ESM interop strategy is sound and both proxy modules correctly prevent concurrent-initialization races. Changes are narrowly scoped to a dependency bump and its CJS/ESM adapter plumbing. Both files cache the promise rather than the resolved value, correctly addressing the previously noted concurrency concern. No proxy configuration options are altered and no new code paths are introduced that could regress existing behavior. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Express/Next as Express / Next.js
participant proxyMiddleware as proxyMiddleware (async wrapper)
participant getProxyMiddleware as getProxyMiddleware()
participant hpm as http-proxy-middleware v4 (ESM)
Note over getProxyMiddleware,hpm: Module cached as _proxyPromise on first call
Client->>Express/Next: HTTP request
Express/Next->>proxyMiddleware: req, res, next
proxyMiddleware->>getProxyMiddleware: await getProxyMiddleware()
alt _proxyPromise already set
getProxyMiddleware-->>proxyMiddleware: return existing promise
else first call
getProxyMiddleware->>hpm: dynamic import('http-proxy-middleware')
hpm-->>getProxyMiddleware: "{ createProxyMiddleware }"
getProxyMiddleware->>hpm: createProxyMiddleware(options)
hpm-->>getProxyMiddleware: RequestHandler
getProxyMiddleware-->>proxyMiddleware: resolved RequestHandler
end
proxyMiddleware->>hpm: middleware(req, res, next)
hpm->>hpm: rewrite path, select router target
hpm-->>Client: proxied response
Reviews (2): Last reviewed commit: "fix: use dynamic import for http-proxy-m..." | Re-trigger Greptile |
E2E Test Results✅ All tests passed • 201 passed • 3 skipped • 1307s
Tests ran across 4 shards in parallel. |
Apply the same ESM-only dynamic import() pattern to the Next.js API catch-all route. Also use a cached promise (instead of a mutable variable) in both files to prevent concurrent-init races on cold start.
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Summary
Removes the
util._extenddeprecation warning (DEP0060) thathttp-proxywas triggering at runtime.Bumps
http-proxy-middlewarefrom v3 to v4 in bothpackages/apiandpackages/app. v4 swaps the underlying proxy engine fromhttp-proxytohttpxy, which eliminates the deprecatedutil._extendcall and brings many upstream fixes, HTTP/2 support, and better performance. ThecreateProxyMiddlewareAPI surface is unchanged.Because v4 ships as ESM-only and the API package emits CJS, the static import in
clickhouseProxy.tsis replaced with a lazyimport()wrapper that initializes once on first request and caches for subsequent calls.Also removes a stale TODO referencing chimurai/http-proxy-middleware#1102 — the underlying
fixRequestBodyissues (text/plain support, content-encoding) are resolved in v4.