Back

What is the possible reasons of the pending label of some of bucket files have?

  • 0
  • Storage
xue
16 Oct, 2023, 22:16

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 ?

TL;DR
Possible reasons for the pending label on some bucket files and a possible solution: - It is suggested to check if the proper update permissions are added. Consider creating an issue to update Appwrite to only require create access if file security is disabled. - If file security is disabled, the permissions added on the file won't have any effect. Ensure that the role of "Any" can read so that everyone can access the files. - Override and give the role of "Users" the "READ" permission to restrict file creation to authenticated users only. - Check the permissions on the bucket and the permissions set when creating the file. - If the
xue
16 Oct, 2023, 22:43

these lines could not be deleted as well

xue
16 Oct, 2023, 22:47
TypeScript
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
xue
16 Oct, 2023, 23:05

everything is the same but different line catch error this time with the same message detail

TypeScript
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
Drake
17 Oct, 2023, 00:33

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)

D5
17 Oct, 2023, 05:43

Are you using an SDK for this?

xue
17 Oct, 2023, 08:15

Yes, appwrite/sdk-for-web 13.0.0

xue
17 Oct, 2023, 14:51

yea this is a chunk issue. should i do something before i upload ?

this is my uploadImage function

TypeScript
  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;
    }
  }
xue
17 Oct, 2023, 14:54

just as a reminder, only i got this issue when i try to upload greater then 5MB images.

D5
17 Oct, 2023, 14:55

From what I know, appwrite SDK chunks uploads automatically so not sure then

D5
17 Oct, 2023, 14:56

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

xue
17 Oct, 2023, 15:00

Yeah! this is only common pattern, otherwise it uploads without any doubt.

xue
19 Oct, 2023, 10:42

So, i could not solve this issue yet, before this ticket get auto-close label, do you have any suggestion ?

D5
19 Oct, 2023, 11:46

It never gets labeled automatically, we label it manually

xue
19 Oct, 2023, 11:48

thanks for this info

xue
19 Oct, 2023, 11:48

👏🏻

Drake
19 Oct, 2023, 20:51

Is the user authenticated? Does the request include the fallback header or session cookie?

xue
20 Oct, 2023, 13:34

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?

Drake
20 Oct, 2023, 14:21

What are the permissions on the bucket? What permissions are you putting when creating the file?

xue
20 Oct, 2023, 18:41

this is permissions of bucket, im not setting any spesific permission while creating a file.

xue
20 Oct, 2023, 18:42

File Security disabled. These files are public info of users like profile picture so everyone can read but only users can create

xue
20 Oct, 2023, 18:43

Should i override to give role of Users to READ permission?

xue
20 Oct, 2023, 18:43

I think if the role of Any can read, then everyone can read!

Drake
20 Oct, 2023, 23:00

if file security is disabled, the permissions you add on the file won't do anything

Drake
20 Oct, 2023, 23:01

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

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