I am on Appwrite self hosted 1.8.0 I use the web sdk 21.3.0
I created a bucket and it has this permission (users:create) then i enabled the file security then i uploaded a file via the sdk and i passed the permission ( team: read, update, delete) and ( loggedInUser: read, update, delete)
When i use the SDK to get the image it fails, all 3 methods gives me 404, end the network tab shows (failed)net::ERR_BLOCKED_BY_ORB
When i set the entire bucket to fully public ( or all users can read ) then i get the image properly
If i get the link from Appwrite's dashboard i get the <,&mode=admin >> in the generated url then the file shows in the browser,
The link from the dashboard is same as the link from the sdk apart from the "mode"
I am not sure why this is not working here is the code i used
return appwriteStorage.getFilePreview({
bucketId:ServerStorageBucketIds.photos,
fileId:photo.objectID,
})
}
anyone please???
after looking here nad there I did find this issue https://github.com/appwrite/sdk-for-flutter/issues/7 it seems like it has fixed on flutter sdk back in 2021 but the issue still exist in the web sdk
this is the permission on the file... I am still getting yhe issue
getFilePreview not working even with permission
looks like your request is getting blocked by CORS, its not a permission issue
I investigated … turns out that I the cookies are not sent by chrome with the request (it explicitly says that it ignored it for the request 😓) … because I am doing the request from localhost and Appwrite is hosted on my domain.
From my research it seems like I can do either
- rest ApI call and pass the JWT token to it (will have to change my UI accordingly)
- add a custom domain to Appwrite so that the CORS get resolved ( I don’t want to do it for prod.. and it won’t help in localhost)
- use cloudflare worker to modify the request to Appwrite and dynamically add the jwt ( this one works better especially because workers executes close to the user location)
- attach a token after uploading a file (not a good idea) at the moment My application is Photo heavy (like Google photo) so doing this many cloud function call just to add a token to a file is not a good idea
[Closed] getFilePreview not working even with permission
Recommended threads
- I'm getting an error on the console "j?....
On my self hosted instance version 1.8.1 the console is giving me this error when trying to view the rows for a table I recently created. My application is read...
- local build `composer installer:dev` iss...
setup - dev container (default linux universal) WSL (test with gh codespace too) - php 8.5.7 - all extensions installed - `composer install` fine - `composer...
- Websites hosted on my appwrite sites hav...
Hello, all my websites hosted on appwrite sites are not running I am getting this message "This site can’t be reached drivehub.appwrite.network took too long t...