Outbound HTTPS responses from api.openai.com truncated on keep-alive connections since 2026-07-04 ~22:00 UTC
brunoaraujo84
HOBBYOP

3 months ago

Since 2026-07-04 ~22:00 UTC, all outbound HTTPS calls from my service to api.openai.com fail with "Premature close" — the request reaches OpenAI (confirmed billed on their side), but the response body arrives truncated. We isolated it with a side-by-side probe running inside the same container:

Request over a keep-alive connection (Connection: keep-alive, Node https.Agent keepAlive:true): fails in <1s with "Invalid response body ... Premature close" — even for tiny ~1KB responses;

The identical request over a fresh connection (keepAlive: false): succeeds consistently (~500-900ms).

Reproducible 100% of the time, single or concurrent connections, affects both buffered and SSE responses. The same calls work fine from other networks with the same API key. No dependency/runtime changes on our side (locked lockfile; reproduced across multiple deploys). We are working around it by disabling connection reuse, but this looks like an egress/NAT/proxy regression mangling HTTP keep-alive framing. Was there an egress change on 2026-07-04? Region: [confira a região do seu serviço em Settings]. Happy to run further probes if useful.

$10 Bounty

2 Replies

Status changed to Awaiting Railway Response Railway • 3 months ago


Railway
BOT

3 months ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • 3 months ago


3 months ago

Is this issue still happening? If so, update your node version to 24.18 or newer to fix it

if you're using railpack, you can simply update it by adding RAILPACK_NODE_VERSION=24.18 to your environment variables

but i think a one-click redeploy should fix it because this issue has been patched weeks ago


enlorik
HOBBY

3 months ago

switch to axios if that doesn’t work or disable the keep alive


Welcome!

Sign in to your Railway account to join the conversation.

Loading...