Replies: 3 comments
|
Your premises check out on this machine. The part I would narrow is "with or without proxy env vars", because that decides the blast radius. Verified here. What I would narrow. With no proxy in the resolved policy, nothing is installed at all:
So the first thing worth pinning in the repro is which policy the host resolved, not whether the shell that launched it exports proxy variables. dsh reads a layered environment (
Boundary: read from the committed tree at |
|
Independent report of the same failure mode, likely the same root-cause component: #7502 — Two data points from there that matter for scoping this issue:
Fix suggestions converge across both threads: don't override the global dispatcher across undici majors (or reuse the runtime's own undici), and consider an explicit content-encoding guard in consumer code as defense in depth. |
|
Correcting my own root cause — with a controlled experiment and fresh-install measurements this time. First, answering @PerryLink: the reporting host resolved But the proxy is not the axis, and 0.1.7-alpha.1 is not the trigger. Same node v22.22.2 (internal undici 6.24.1),
3/3 runs each. Two consequences:
End-to-end check on the real symptom surface. Running
Upstream cause, now confirmed:
Net ask on the dsh side is one line: pin The workaround in the original post still holds for anyone already on 8.11.0: launch with no proxy env at all, so no dispatcher is installed. Minimal repro: import { Agent, setGlobalDispatcher } from 'undici' // 8.11.0
setGlobalDispatcher(new Agent()) // new Agent({ allowH2: false }) makes it work
const r = await fetch('https://registry.npmjs.org/@deepseek-ai%2Fdsh',
{ headers: { accept: 'application/vnd.npm.install-v1+json' } })
console.log(r.headers.get('content-encoding')) // null on 8.11.0, 'br' on 8.10.2
await r.json() // throws on 8.11.0 |
Uh oh!
There was an error while loading. Please reload this page.
Symptom (starting from 0.1.7-alpha.1)
The version-update panel (dsh-version-update@1.4.0) always reports:
Bytes 1F 8B 08 are a gzip header: the body arrives undecoded despite HTTP 200.
Same failure hits the plugin's GitHub release-notes fetch, so it is host-global,
not registry-specific. curl and a fresh node process (same URL/headers/timeout,
same proxy or direct) both work. Only the dsh web host fails, deterministically,
across restarts, with or without proxy env vars.
Root cause
profile-boot calls installProxyFromEnvironment() from @deepseek-ai/dsh-http-proxy,
which replaces the global dispatcher with one built from bundled npm undici@8.11.0
(Agent factory returning ProxyAgent / Pool). But Node v22.22.2 built-in fetch runs
internal undici 6.24.1. The cross-major dispatcher breaks content-encoding propagation.
Minimal repro (same node binary, internal undici 6.24.1):
With the pristine internal dispatcher (or the same experiment using undici@7.29.0
classes), content-encoding br/gzip is present and r.json() parses. So the
v8-dispatcher + v6-fetch combination is the breaking one.
Environment
Suggested fix
Build the global dispatcher from an undici compatible with the runtime internal one
(or reuse the internal instance), or skip overriding the global dispatcher when the
bundled undici major differs from the runtime. Note: with no proxy configured
(source none) nothing is installed and everything works, confirming the dispatcher
is the trigger.
Workaround
Launch with proxy env fully unset so no dispatcher gets installed:
Unsetting only http(s)_proxy is NOT enough: any leftover name (e.g. ALL_PROXY)
still triggers installation.
All reactions