Back

[SOLVED] 404 error when previewing bucket image in Flutter app only

  • 0
  • Storage
  • Cloud
Said H
1 Oct, 2023, 03:36

So, i suspect it has something to do with permission.

TL;DR
There was a 404 error when previewing a bucket image in a Flutter app only. The issue was with permissions. The solution was to add guest permission for read-only and append `&mode=guest` to the view URL. Another solution was to remove and re-add the permissions to the file. The issue was resolved by toggling off and on the "users" access at the bucket settings. There was a difference in permission settings for view and preview. The preview link was showing a 404 error, but the view link was working fine.
Said H
1 Oct, 2023, 03:36

however, the file has the read permissin granted to my login account

Drake
1 Oct, 2023, 03:39

Is file security enabled?

Said H
1 Oct, 2023, 03:40

yes

Drake
1 Oct, 2023, 03:40

What's your code?

Said H
1 Oct, 2023, 03:40

this is from the bucket setting

Said H
1 Oct, 2023, 03:41

and this is at the file level

Said H
1 Oct, 2023, 03:42

wait a min. now I can access it. Weird. I simply toggled off and on the "users" access at the bucket setting to investigate

Said H
1 Oct, 2023, 03:44

I can now access it with the view link, but when i tried with preview link, it shows 404

Said H
1 Oct, 2023, 03:44

Is there any difference in permission setting for view and preview?

Said H
1 Oct, 2023, 03:51

in conclusion:

  • view = working
  • preview = 404 error
  • preview with admin mode = working
Said H
1 Oct, 2023, 04:20

Hi @Steven , I don't know what's wrong. I removed the permission and re-added the same exact permission to that file, and everything works now.

Said H
1 Oct, 2023, 04:20

Thanks for helping me looking into this.

Said H
1 Oct, 2023, 04:20

[SOLVED] 404 error if mode=admin is removed

Said H
1 Oct, 2023, 06:00

Hi @Steven , the issue came back. So, I repeated the same thing (removing the permissions and re-added), and it worked again. Do you think this could be my data error?

Said H
2 Oct, 2023, 07:54

Login using the same credential, I can run https://cloud.appwrite.io/v1/storage/buckets/message/files/651a750284dae18644e3/preview?project=huntpile in a React web, but I can't in Flutter app. It just show 404 error. It may not be the permission issue because I can view it in web using the same credential. In Flutter app, I am able to access other buckets' preview images too.

Said H
2 Oct, 2023, 07:55

404 error when previewing bucket image in Flutter app only

Said H
2 Oct, 2023, 08:06

I deleted the bucket and recreated it, but the outcome is still the same. I can't view the image from flutter app, but able to do it in React web. Same login credentials.

Ernest
2 Oct, 2023, 13:36

Had a side project I was working with the same issue. At the time, I was mostly hacking stuff together (it wasn't a production app) so I thought I was doing something wrong. I ended up adding guest permission for read only and appending the mode (&mode=guest) to the view url. I know this is doesn't answer the question. Just pointing out the problem has been around for a while.

Said H
5 Oct, 2023, 00:54

Hey @Ernest , thanks very much for your input and for letting me know about the other case that has been resolved by Steven. I will try that now

Said H
5 Oct, 2023, 01:35

Steven's suggestion works perfectly. Thanks @Ernest and @Steven

Said H
5 Oct, 2023, 01:35

[SOLVED] 404 error when previewing bucket image in Flutter app only

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