In digital ocean limits i found something in their docs
PUT
requests and individual parts of multi-part uploads sent to the Spaces CDN using pre-signed URLs have a maximum payload of 8,100 KiB, or 7.91 MiB.
Do you know that does appwrite use PUT
request while creating a file ?
these lines could not be deleted as well
appwrite | [Error] Method: DELETE
appwrite | [Error] URL: /v1/storage/buckets/:bucketId/files/:fileId
appwrite | [Error] Type: Exception
appwrite | [Error] Message:
appwrite | [Error] File: /usr/src/code/vendor/utopia-php/storage/src/Storage/Device/S3.php
appwrite | [Error] Line: 852
appwrite | [Error] Timestamp: 2023-10-16T22:43:15+00:00
appwrite | [Error] Method: DELETE
appwrite | [Error] URL: /v1/storage/buckets/:bucketId/files/:fileId
appwrite | [Error] Type: Exception
appwrite | [Error] Message:
appwrite | [Error] File: /usr/src/code/vendor/utopia-php/storage/src/Storage/Device/S3.php
appwrite | [Error] Line: 852
appwrite | [Error] Timestamp: 2023-10-16T22:43:16+00:00
appwrite | [Error] Method: DELETE
appwrite | [Error] URL: /v1/storage/buckets/:bucketId/files/:fileId
appwrite | [Error] Type: Exception
appwrite | [Error] Message:
appwrite | [Error] File: /usr/src/code/vendor/utopia-php/storage/src/Storage/Device/S3.php
appwrite | [Error] Line: 852
appwrite | [Error] Timestamp: 2023-10-16T22:46:21+00:00
everything is the same but different line catch error this time with the same message detail
appwrite | [Error] Method: POST
appwrite | [Error] URL: /v1/storage/buckets/:bucketId/files
appwrite | [Error] Type: Appwrite\Extend\Exception
appwrite | [Error] Message: The current user is not authorized to perform the requested action.
appwrite | [Error] File: /usr/src/code/app/controllers/api/storage.php
appwrite | [Error] Line: 664
This might be due to failed uploads. for uploads greater than 5MB, the needs to be chunked...and the user needs to be able to upload each chunk (so they must be authenticated)
Are you using an SDK for this?
Yes, appwrite/sdk-for-web 13.0.0
yea this is a chunk issue. should i do something before i upload ?
this is my uploadImage
function
async uploadImage(blob: any) {
let url = '';
try {
var file = new File([blob], this.cUserId, { type: blob.type });
// userService is a service with user related operations connected to appwrite-web-sdk
await this.userService.uploadFile(file).then(
(response) => {
console.log(response); // Success
url = this.userService.getFileView(response.$id).href;
console.log(url); // Resource URL
},
function (error) {
console.log(error); // Failure
}
);
return url;
} catch (e) {
throw e;
}
}
just as a reminder, only i got this issue when i try to upload greater then 5MB images.
From what I know, appwrite SDK chunks uploads automatically so not sure then
But at least from what I'm seeing, there is a common pattern in the screenshots you sent who is that all files with a size bigger than 6MB tend to fail
Yeah! this is only common pattern, otherwise it uploads without any doubt.
So, i could not solve this issue yet, before this ticket get auto-close label, do you have any suggestion ?
It never gets labeled automatically, we label it manually
thanks for this info
👏🏻
Is the user authenticated? Does the request include the fallback header or session cookie?
yes user authenticated, thats why first chunk has been written in appwrite successfully, i am using the same api call, less than 5M is ok, it uploads well as shown in the screenshot.
However greater than 5M is returning code 401. i am calling the same function, less then 5M uploads fine without any error. Greater then 5M returns 401.
Still get confused why it happens?
What are the permissions on the bucket? What permissions are you putting when creating the file?
this is permissions of bucket, im not setting any spesific permission while creating a file.
File Security disabled. These files are public info of users like profile picture so everyone can read but only users can create
Should i override to give role of Users
to READ
permission?
I think if the role of Any
can read, then everyone can read!
if file security is disabled, the permissions you add on the file won't do anything
i think you may need to add update permissions...but feel free to create an issue to see if Appwrite can be updated to only require create access
Recommended threads
- Storage files aren’t showing on mobile
hi, what can be the problem? i have a storage and there are images in it, the permissions are read for All Users, everything is fine on desktop, but on mobile t...
- Delete storage files all at once
I am using Appwrite Cloud. I want to delete all storage files in my bucket similar to how I can select all documents in a collection and delete them all at once...
- Storage images are not showing on mobile
Hi, can anyone help me? I have some images on the storage, and it is not shown on mobile, on desktop everything is fine.