ECONNRESET and ECONNABORTED triggered by mp4 after reloading browser

System Information
  • STRAPI: 3.6.8:
  • OS: Windows 10:
  • DB: MySQL:
  • NODE: 14.16.0:
  • NPM: 6.14.11:
  • yarn not used:

Hi, first time posting. If something is missing, please let me know.

  • Frontend is nextjs

  • I have a gallery containing multiple videos. The url points to the strapiURL/public/uploads/someVideo.mp4 folder

      <source src={url} type="video/mp4" />
      Your browser does not support the video tag.
  • Everything is working fine, but I see the following error messages in the strapi console after ctrl+F5 multiple times.
[2022-02-08T12:45:24.545Z] debug GET /uploads/page_image_upload_de566d6a326995f52889a60050b0df28_fe843264da_97bb3bd42b.png (18 ms) 200
[2022-02-08T12:45:24.548Z] debug GET /uploads/page_image_upload_50466777ac2c897cf518cceee38998b6_9f55ed5d78_d158e55080.png (12 ms) 200
[2022-02-08T12:45:24.607Z] debug GET /uploads/page_file_upload_7cb3e4ab0a14bfb1b3f067760b9d1997_d1a11dd073_c9ec7854aa.mp4 (11 ms) 206
[2022-02-08T12:45:24.634Z] debug GET /uploads/page_file_upload_fbec57eb9b9b0326f8f9784185f426e5_b85f0c8d61_5e35e26498.mp4 (22 ms) 206

  Error: read ECONNRESET
      at TCP.onStreamRead (internal/stream_base_commons.js:209:20)

  Error: read ECONNRESET
      at TCP.onStreamRead (internal/stream_base_commons.js:209:20)

[2022-02-08T12:45:24.849Z] debug GET /draftpages/cms/1 (246 ms) 200
[2022-02-08T12:45:24.895Z] debug GET /uploads/upload_2397816406f6d19d0f193390291f772a_715f2443f9.jpg (5 ms) 200
[2022-02-08T12:45:24.900Z] debug GET /uploads/upload_7585a38bb9bcadc85aa157889ed00de1_a58a277ff0.jpg (5 ms) 200
[2022-02-08T12:45:24.958Z] debug GET /uploads/upload_de566d6a326995f52889a60050b0df28_fe843264da.png (4 ms) 200


[2022-02-08T12:47:05.953Z] debug GET /uploads/upload_7585a38bb9bcadc85aa157889ed00de1_a58a277ff0.jpg (22 ms) 200 
[2022-02-08T12:47:05.955Z] debug GET /uploads/page_image_upload_de566d6a326995f52889a60050b0df28_fe843264da_97bb3bd42b.png (18 ms) 200
[2022-02-08T12:47:06.017Z] debug GET /uploads/page_file_upload_7cb3e4ab0a14bfb1b3f067760b9d1997_d1a11dd073_c9ec7854aa.mp4 (9 ms) 206
[2022-02-08T12:47:06.057Z] debug GET /uploads/page_file_upload_fbec57eb9b9b0326f8f9784185f426e5_b85f0c8d61_5e35e26498.mp4 (17 ms) 206

  Error: write ECONNABORTED
      at afterWriteDispatched (internal/stream_base_commons.js:156:25)
      at writeGeneric (internal/stream_base_commons.js:147:3)
      at Socket._writeGeneric (net.js:785:11)
      at Socket._write (net.js:797:8)
      at doWrite (internal/streams/writable.js:377:12)
      at clearBuffer (internal/streams/writable.js:529:7)
      at Socket.Writable.uncork (internal/streams/writable.js:317:7)
      at connectionCorkNT (_http_outgoing.js:733:8)
      at processTicksAndRejections (internal/process/task_queues.js:79:21)

[2022-02-08T12:47:08.880Z] debug GET /uploads/page_file_upload_7cb3e4ab0a14bfb1b3f067760b9d1997_d1a11dd073_c9ec7854aa.mp4 (5 ms) 206
[2022-02-08T12:47:08.882Z] debug GET /uploads/page_file_upload_fbec57eb9b9b0326f8f9784185f426e5_b85f0c8d61_5e35e26498.mp4 (4 ms) 206
[2022-02-08T12:47:08.903Z] debug GET /uploads/upload_5e31d363aec03cde1eba183ecbb4056a_5dfdcac7fe.jpg (7 ms) 200

To me it looks like the video stream connection between frontend and strapi gets interrupted and strapi just throws the error in the console but nothing breaks or crashes.
My question now is, is there a way to handle these errors and what can I do to prevent them if necessary?

I build a simple test case. Started a complete new strapi project, same version. Uploaded a test.mp4 with the media library. Created a super simple html file and got instantly the same error message. No errors in browser console. Videos plays fine. I feel like I am doing something completely wrong. Is this not the correct way to host videos with strapi?

Have you had any luck with this? I’m getting the same but usually with some big .pdf files.

I don’t really know this, but I read that it might just be the standard behaviour, where a request for large files is split into different parts and that error is thrown when the first non-ranged request is cancelled (see Again, not sure that’s the exact case, but I can load pdfs fine on the frontend, that’s just an error that appears from time to time in the strapi logs.

1 Like

I found out that it was the initial buffering of <video />, changed it to <video preload="none" /> as an ok workaround for now. The error is thrown by koa.js. I haven’t had the time to further look into strapi how to best catch the error message.

Better description of my case: