appwrite / appwrite/sdk-for-react-native

๐Ÿ› Bug Report: "Entity Too Small" 400 error in file upload

Open
#73 2 comments 0 reactions 1 assignee Claimed by @ChiragAgg5k View on GitHub
bug
Dominant language
TypeScript
Stars
4.3k
Forks
36
Avg merge
2h 50m
Merged PRs (30d)
1

Description

### ๐Ÿ‘Ÿ 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?

- [x] I checked and didn't find similar issue

### ๐Ÿข Have you read the Code of Conduct?

- [x] I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.