Files
homefeed/backend/package.json
T
Claude bfd7967bbb Fix synthesis fetch failures from Node's default 5-minute HTTP timeout
Nothing published for hours, every cluster failing with "fetch failed".
Ollama's own log showed the real story: requests being cancelled at
exactly 5m0s with a 500, not a model or server error. Node's global
fetch (undici) defaults to a 5-minute headers/body timeout, and CPU-only
prompt processing on the reference hardware (i5-6600K, no GPU, ~17
tok/s) legitimately takes longer than that once prompts carry full
article bodies instead of short blurbs (the previous fix in this same
line of work) — every generate() call past a few thousand tokens got
killed client-side before Ollama could finish.

OllamaProvider.generate() now passes a dedicated undici Agent with
headersTimeout/bodyTimeout disabled as the fetch dispatcher, so the
request runs as long as it actually needs to. Verified the failure
mode and the fix directly: a short-timeout dispatcher against a
deliberately slow server reproduces the exact same "fetch failed" /
UND_ERR_HEADERS_TIMEOUT error seen in production, and a zero-timeout
dispatcher completes the same slow request without issue.

undici was already a transitive dependency (via jsdom); added directly
since ollama-provider.ts now imports from it.
2026-07-27 13:10:58 +00:00

31 lines
809 B
JSON

{
"name": "homefeed-backend",
"version": "1.0.0",
"description": "Homefeed backend — ingestion, clustering, synthesis, and the public/admin API",
"type": "module",
"main": "dist/index.js",
"scripts": {
"dev": "tsx watch --env-file=.env src/index.ts",
"build": "tsc",
"start": "node --experimental-sqlite dist/index.js",
"typecheck": "tsc --noEmit"
},
"license": "UNLICENSED",
"dependencies": {
"@fastify/cookie": "^11.1.2",
"@fastify/cors": "^11.3.0",
"@mozilla/readability": "^0.6.0",
"fastify": "^5.10.0",
"jsdom": "^29.1.1",
"rss-parser": "^3.13.0",
"telegram": "^2.26.22",
"undici": "^7.28.0"
},
"devDependencies": {
"@types/jsdom": "^28.0.3",
"@types/node": "^26.1.1",
"tsx": "^4.23.0",
"typescript": "^7.0.2"
}
}