Skip to content

馃悰 Bug Report: "Entity Too Small" 400 error in file upload聽#73

Description

@AMUZYZOHO

馃憻 Reproduction steps

When I try to upload an image using the storage.createFile method, I get a response of 400 status code.

The image is 5.13 mb.

馃憤 Expected behavior

What ought to happen is that the image gets partitioned and uploaded in chunks of which 5mb is the set chunk size for multipart file upload to Amazon s3 storage provider.
5.13mb = 5mb + 135kb.

馃憥 Actual Behavior

What eventually happens is that the first chunk 5mb gets uploaded, but then the second and final chunk fails to upload giving the "Entity too small" error.
Meanwhile the final chunk is permitted to be smaller than 5mb.
So is it that the SDK doesn't know that that is the final chunk?

Someone posted a fix in a stack overflow link. Quoted
"
Apparently, it's part of the completeMultiPartUpload function. That's where the error is being thrown.

Details: The uploadPart is taking my data, whatever my chunk size is, and storing it in a pool of some sort. The error is being thrown at the maxPartSize, being too small. Changing that to anything greater than 5 MB solved the issue.
"

馃幉 Appwrite version

Version 0.10.x

馃捇 Operating system

Windows

馃П Your Environment

I use react-native-appwrite 0.13.0 . The mobile app is a native development build from EAS

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

Activity

  1. AMUZYZOHO commented on Sep 20, 2025

    @AMUZYZOHO
    Author

    @eldadfux @TorstenDittmann @abnegate @suhasdeshpande @DylanG-64 @ChiragAgg5k

    Please can someone help address this? It's been over a week I raised this issue.

  2. self-assigned this
    on Oct 14, 2025
  3. ChiragAgg5k commented on Oct 14, 2025

    @ChiragAgg5k
    Member

    @AMUZYZOHO i see the issue:

    Image

    there is a mismatch in content-range header and is actually being sent, in your case:

    • First chunk: Content-Range says 5MB, actual data is 5MB
    • Second chunk: Content-Range says 135KB, but actual data is 5MB which leads to error

    it should instead be:

    const chunkSize = Math.min(Service.CHUNK_SIZE, size - offset);
    
     let chunk = await FileSystem.readAsStringAsync(file.uri, {
         encoding: FileSystem.EncodingType.Base64,
         position: offset,
         length: chunkSize  // Use calculated size instead of fixed CHUNK_SIZE
     });

    will fix it soon. thanks for raising this 馃檹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions