Multipart file uploads to external APIs failing with "Premature close" — networking issue
sjbarton58-product
HOBBYOP

5 days ago

Description:

Our Node.js service is experiencing consistent failures on all outbound multipart file uploads to OpenAI and Groq APIs, despite multiple code and configuration fixes. We believe this is a Railway networking issue.

Service Details

Project: fearless-courtesy

Service Name: lumi

Service ID: ad5defbd-ba0a-4cdb-b0bf-d423ba65f318

Environment ID: 31304179-b57a-40cc-8628-e489cc74fd1c

Region: EU West (europe-west4-drams3a)

Runtime: Node.js v24.18.0

Problem

Multipart file uploads to external APIs fail with: Invalid response body while trying to fetch https://api.openai.com/v1/audio/transcriptions: Premature close Invalid response body while trying to fetch https://api.groq.com/openai/v1/audio/transcriptions: Premature close

Affected Endpoints

https://api.openai.com/v1/audio/transcriptions (OpenAI Whisper)

https://api.groq.com/openai/v1/audio/transcriptions (Groq Whisper)

File Details

File sizes: 84KB to 1.8MB (well within OpenAI's 25MB limit)

File types: WebM, M4A, MP3, WAV, OGG, FLAC

Upload method: OpenAI SDK v4.104.0 with File object (Buffer-based)

Troubleshooting Already Completed

SDK Upgrade (Deployment 6a5e0354)

Upgraded OpenAI SDK from v4.52.7 to v4.104.0

Result: No improvement

Code Fix: ReadStream to Buffer (Deployment 38c4b28c)

Changed from createReadStream() to readFileSync() + File object

Eliminates stream lifecycle issues

Result: No improvement

IPv6 Egress (Current config)

Enabled ipv6EgressEnabled: true

Result: No improvement

Evidence

Current Service Config: ipv6EgressEnabled: true multiRegionConfig: europe-west4-drams3a (1 replica)

Latest Deployment with Errors (38c4b28c):

Created: 2026-07-02T08:29:37.399Z

Status: SUCCESS

Commit: 9101aa998c2bb220a3e68253d16f571f84c2e1ad

Sample Error Logs (Deployment 38c4b28c): [whisper] Sending file: /app/data/audio/1782937644646-ex4nnqrshqt.webm (1863991 bytes) [whisper] OpenAI transient error — retrying in 2s (attempt 1/3) [whisper] OpenAI transient error — retrying in 6s (attempt 2/3) [whisper] OpenAI unavailable — falling back to Groq [whisper] Groq fallback also failed: Invalid response body while trying to fetch https://api.groq.com/openai/v1/audio/transcriptions: Premature close [failed-entry-retry] Entry 246 still failing: Invalid response body while trying to fetch https://api.openai.com/v1/audio/transcriptions: Premature close

Consistent Pattern:

All 3 OpenAI retry attempts fail with "Premature close"

Groq fallback also fails with same error

Errors occur on files of varying sizes (84KB to 1.8MB)

Standard REST API calls work fine (non-multipart requests succeed)

Issue started approximately 2026-07-01 22:00 BST

Dashboard shows service as Online with no issues, but logs show continuous failures

Key Observations

Files are being read correctly (logged file sizes confirm)

Retry logic is working (3 attempts per file)

Code uses stateless File objects (no stream state issues)

IPv6 egress is enabled

Both OpenAI and Groq fail simultaneously (suggests shared infrastructure issue)

Only multipart uploads fail (standard REST calls work)

Service status shows healthy but logs show persistent failures

Request

Please investigate whether there's a networking issue on the EU West region affecting multipart form-data uploads to external APIs. This appears to be an infrastructure-level issue rather than an application code problem. We also suspect this may be related to the known EU West edge network issues reported in May 2026.

Solved$10 Bounty

0 Replies

Railway
BOT

5 days ago

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

Status changed to Open Railway 5 days ago


Status changed to Solved sjbarton58-product 5 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...