#[SOLVED] Bucket permissions issue on development

36 messages · Page 1 of 1 (latest)

timber marsh
#

Hello, I'm facing an issue right now with bucket permissions. I have been debugging a lot, and researching here on discord and github and I actually found a workaround, but I want to know if its a better way to fix this.

My enviroment:

  • Appwrite 1.6.0 Selfhosted on a VPS on USA on lets say https://appw.example.com
  • Frontend: Sveltekit, CSR (to deploy probably a SPA) NO SSR http://localhost:5173

Right now I'm developing an app where the user can upload a user profile pic. So I decided to create a collection to store user info paired with the auth user info. And for the profile pic I use a bucket to store the photo.

The problem is that when I put permissions on the bucket for Users I start getting an error 404 requested file is not found. If I put the permissions to Any I will get access to the file.

I did started investigating about this. And found that the problems are cookies. It got blocked for some reason, or those are not being sended.

What I did to try to fix:

  • Test incognito mode (Didn't work)
  • Test 3 different browsers (Didn't work)
  • Enable 3rd party cookies (Didn't work)
  • Modify my hosts file, and add something like 127.0.0.1 local.example.com

With the last option actually make a progress, I did run my Vite server on local.example.com , Then I go to http://local.example.com:5173 and I get kicked out of my app, so I start debugging again. And I find some error that I have never seen, the Set-Cookie of the session was not working because SameSite property, and Secured.

I did ask chatgpt for this, and it suggest me to create my own cert and apply them to Vite so I did create some certs, put it inside Vite and it actually did worked finally. I can access now buckets with permissions enabled.

So the question:

Is this the correct and easiest way to fix this? I mean, everyone is facing something similar in the moment they start developing locally with no SSR? Or this is just some weird bug in my end. Thanks

gilded jackal
#

Bucket permissions issue on development

gilded jackal
#

The authentication needs to set a cookie. And then that cookie needs to be included in the request for the file

timber marsh
#

Hello Steven, nice to see you again.

I understand what you said, and I did get to the same conclusion. The question is if I have a workaround that doesn't require to me to create my own certs to develop in localhost using a cloud instance of appwrite.

I mean, It could be nice its there are something more simple, but keeping the permissions functionality without setting them to Any

Thanks again.

gilded jackal
timber marsh
#

no cookies

gilded jackal
timber marsh
#

ligoforms is the project name

gilded jackal
# timber marsh

So it was filtered out of the request. You should be able to see why it was filtered out. Maybe hover over it or something. I can't remember how

timber marsh
#

I will try to translate:

"The cookie was stablished as "SamesSite=Lax" on default way, due to it doesnt specify any attribute "SameSite" when it was saved. and it was blocked because the request was made on other site, and it was not started a superior level navigation. To enable the use of mutiple sites, the cookie must has been established as "SameSite=None"

#

Cannot copy paste so I translate by hand, hope you understand Steven

gilded jackal
#

There should be a a_session_ligoforms

timber marsh
#

I dont know why is not there, actually on database requests it is there

gilded jackal
timber marsh
#

1.6 and yes. NPM on proxmox

gilded jackal
#

Make sure the request to Appwrite is https and not http

timber marsh
#

yes it is actually on https

gilded jackal
timber marsh
#

Do you know what is the name of the config file? haha I actually use it through Web UI

gilded jackal
timber marsh
gilded jackal
#

It needs to be https

timber marsh
#

So port 443?

#

Holy moly

gilded jackal
timber marsh
#

I think it is

#

Its working now!

#

Thank you so much, I have to clear cache, probably cookie was wrong or something. But now it works! Thank you so much!