Skip to content

Commit 3062747

Browse files
authored
fix(seeder): force HTTP/1.1 ALPN in proxy tunnel to prevent h2 parse error (koala73#2454)
* chore: redeploy to pick up WORLDMONITOR_VALID_KEYS fix * fix(seeder): force HTTP/1.1 ALPN in proxy tunnel to prevent h2 parse error api.stlouisfed.org supports HTTP/2. tls.connect() includes h2 in ALPN by default, causing the server to negotiate HTTP/2. But https.request uses HTTP/1.1 parser, so HTTP/2 binary frames fail with: Parse Error: Expected HTTP/, RTSP/ or ICE/ Fix: ALPNProtocols: ['http/1.1'] forces HTTP/1.1 over the tunnel. * fix(seeder): increase FRED direct fetch timeout 10s→20s WALCL is first in FRED_SERIES and fires at cold container start. TCP + TLS + FRED API response on a cold connection was hitting the 10s limit. All other series benefit from the established connection pool. 20s matches the original curl --max-time 15 plus handshake overhead.
1 parent c8a66d2 commit 3062747

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scripts/_seed-utils.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ async function httpsProxyFetchJson(url, proxyAuth) {
369369
}).on('error', reject).end();
370370
});
371371

372-
const tlsSock = tls.connect({ socket, servername: targetUrl.hostname });
372+
const tlsSock = tls.connect({ socket, servername: targetUrl.hostname, ALPNProtocols: ['http/1.1'] });
373373
await new Promise((resolve, reject) => {
374374
tlsSock.on('secureConnect', resolve);
375375
tlsSock.on('error', reject);
@@ -408,7 +408,7 @@ async function httpsProxyFetchJson(url, proxyAuth) {
408408
// Fetch JSON from a FRED URL, routing through proxy when available.
409409
export async function fredFetchJson(url, proxyAuth) {
410410
try {
411-
const r = await fetch(url, { headers: { Accept: 'application/json' }, signal: AbortSignal.timeout(10_000) });
411+
const r = await fetch(url, { headers: { Accept: 'application/json' }, signal: AbortSignal.timeout(20_000) });
412412
if (r.ok) return r.json();
413413
throw Object.assign(new Error(`HTTP ${r.status}`), { status: r.status });
414414
} catch (directErr) {

0 commit comments

Comments
 (0)