In app/api/upload-chart/route.ts, the uploaded file is fully buffered with Buffer.from(await file.arrayBuffer()) before being written. Large files or concurrent uploads can exhaust heap memory.
Fix
Stream the file directly to disk instead of buffering the full ArrayBuffer.
In
app/api/upload-chart/route.ts, the uploaded file is fully buffered withBuffer.from(await file.arrayBuffer())before being written. Large files or concurrent uploads can exhaust heap memory.Fix
Stream the file directly to disk instead of buffering the full ArrayBuffer.