Back

[solved] File Upload from Rust Code returns 500 Internal Error at last chunk

  • 0
  • Self Hosted
  • Storage
  • REST API
WuGGu
22 Apr, 2024, 13:05
TypeScript
Warning: file_get_contents(/storage/uploads/app-650f0846f11fae53fe7c/651155e99b8b3b3523d4/tmp_66265f0a6129adc5a67a.mp4/66265f0a6129adc5a67a.part.79): Failed to open stream: No such file or directory in /usr/src/code/vendor/utopia-php/storage/src/Storage/Device/Local.php on line 181
[Error] Timestamp: 2024-04-22T12:59:03+00:00
[Error] Method: POST
[Error] URL: /v1/storage/buckets/:bucketId/files
[Error] Type: Exception
[Error] Message: Failed to read chunk /storage/uploads/app-650f0846f11fae53fe7c/651155e99b8b3b3523d4/tmp_66265f0a6129adc5a67a.mp4/66265f0a6129adc5a67a.part.79
[Error] File: /usr/src/code/vendor/utopia-php/storage/src/Storage/Device/Local.php
[Error] Line: 183

this is what my Appwrite Docker Container returns as log. The file is round about 300mb big and the error always appears at the last chunk.

I have no idea what can create this error by looking at the loggings. I added Error handling to my rust code and get this error:

TypeScript
worker::video_cutter: Failed to upload chunk: HTTP 500 Internal Server Error - {"message":"Server Error","code":500,"type":"general_unknown","version":"1.5.4"}

Any tips for debugging is highly appreciated.

TL;DR
File upload from Rust code was returning a 500 Internal Server Error at the last chunk. The issue was traced back to content-range end not being 1 less than the file size. By adjusting the limits appropriately in the code, the error was resolved. An error message related to file chunk reading was noted, occurring at the last chunk of a 300mb file. Debugging steps were taken by handling errors in the Rust code to pinpoint the issue further.
WuGGu
22 Apr, 2024, 13:34

ok found the error I think. Thanks to the great feature of looking through Discord conversations over the appwirte website I found the bug report about "content-range end should be 1 less than file size" And of course was the error that my limits where not -1.

WuGGu
22 Apr, 2024, 13:35

[solved] File Upload from Rust Code returns 500 Internal Error at last chunk

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more